2017-11-27 05:45:24 -05:00
|
|
|
# frozen_string_literal: true
|
2010-04-01 03:45:16 -04:00
|
|
|
require File.expand_path '../xref_test_case', __FILE__
|
|
|
|
|
|
|
|
class TestRDocNormalModule < XrefTestCase
|
|
|
|
|
|
|
|
def setup
|
|
|
|
super
|
|
|
|
|
|
|
|
@mod = RDoc::NormalModule.new 'Mod'
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_ancestors_module
|
2012-11-26 23:28:14 -05:00
|
|
|
top_level = @store.add_file 'file.rb'
|
2010-04-01 03:45:16 -04:00
|
|
|
mod = top_level.add_module RDoc::NormalModule, 'Mod'
|
|
|
|
incl = RDoc::Include.new 'Incl', ''
|
|
|
|
|
|
|
|
mod.add_include incl
|
|
|
|
|
2010-12-19 22:22:49 -05:00
|
|
|
assert_equal [incl.name], mod.ancestors
|
|
|
|
|
|
|
|
mod2 = top_level.add_module RDoc::NormalModule, 'Inc2'
|
|
|
|
inc2 = RDoc::Include.new 'Inc2', ''
|
|
|
|
mod.add_include inc2
|
|
|
|
assert_equal [mod2, incl.name], mod.ancestors
|
2010-04-01 03:45:16 -04:00
|
|
|
end
|
|
|
|
|
2013-09-18 19:33:36 -04:00
|
|
|
def test_aref
|
|
|
|
assert_equal 'module-M1', @m1.aref
|
|
|
|
assert_equal 'module-M1::M2', @m1_m2.aref
|
|
|
|
end
|
|
|
|
|
2011-02-01 19:32:30 -05:00
|
|
|
def test_definition
|
|
|
|
m = RDoc::NormalModule.new 'M'
|
|
|
|
|
|
|
|
assert_equal 'module M', m.definition
|
|
|
|
end
|
|
|
|
|
2010-04-01 03:45:16 -04:00
|
|
|
def test_module_eh
|
|
|
|
assert @mod.module?
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|