File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -1358,6 +1358,33 @@ def test_parse_comment_nested
13581358 assert_equal 'comment' , c . comment
13591359 end
13601360
1361+ def test_parse_constant_with_bracket
1362+ util_parser <<-RUBY
1363+ class Klass
1364+ end
1365+
1366+ class Klass2
1367+ CONSTANT = Klass
1368+ end
1369+
1370+ class Klass3
1371+ CONSTANT_2 = {}
1372+ CONSTANT_2[1] = Klass
1373+ end
1374+ RUBY
1375+
1376+ @parser . scan
1377+
1378+ klass = @store . find_class_named 'Klass'
1379+ klass2 = @store . find_class_named 'Klass2'
1380+ klass3 = @store . find_class_named 'Klass3'
1381+ constant = klass2 . find_module_named 'CONSTANT'
1382+ constant2 = klass3 . find_module_named 'CONSTANT_2'
1383+ assert_equal klass , klass2 . constants . first . is_alias_for
1384+ refute_equal klass , klass3 . constants . first . is_alias_for
1385+ assert_nil klass3 . find_module_named 'CONSTANT_2'
1386+ end
1387+
13611388 def test_parse_extend_or_include_extend
13621389 klass = RDoc ::NormalClass . new 'C'
13631390 klass . parent = @top_level
You can’t perform that action at this time.
0 commit comments