Skip to content

Commit cc55d91

Browse files
committed
Add test_parse_constant_the_same_of_outside
1 parent 96964f5 commit cc55d91

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

test/test_rdoc_parser_ruby.rb

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1377,6 +1377,35 @@ class A::B
13771377
refute_includes module_a.classes_hash, 'A'
13781378
end
13791379

1380+
def test_parse_constant_the_same_of_outside
1381+
util_parser <<-RUBY
1382+
module A
1383+
class B
1384+
class C
1385+
end
1386+
end
1387+
1388+
def self.foo
1389+
A::B::C
1390+
end
1391+
end
1392+
RUBY
1393+
1394+
expected = <<EXPECTED
1395+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">foo</span>
1396+
<span class="ruby-constant">A</span><span class="ruby-operator">::</span><span class="ruby-constant">B</span><span class="ruby-operator">::</span><span class="ruby-constant">C</span>
1397+
<span class="ruby-keyword">end</span>
1398+
EXPECTED
1399+
expected = expected.rstrip
1400+
1401+
@parser.scan
1402+
1403+
module_a = @store.find_module_named 'A'
1404+
foo = module_a.method_list.first
1405+
markup_code = foo.markup_code.sub(/^.*\n/, '')
1406+
assert_equal expected, markup_code
1407+
end
1408+
13801409
def test_parse_constant_with_bracket
13811410
util_parser <<-RUBY
13821411
class Klass

0 commit comments

Comments
 (0)