Skip to content

Commit dde8f6a

Browse files
committed
Add test_class_tokenize_square_bracket_as_method
1 parent 1f72f37 commit dde8f6a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/test_rdoc_ruby_lex.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,5 +435,24 @@ def test_rational_imaginary_tokenize
435435
assert_equal expected, tokens
436436
end
437437

438+
def test_class_tokenize_square_bracket_as_method
439+
tokens = RDoc::RubyLex.tokenize "Array.[](1, 2)", nil
440+
441+
expected = [
442+
@TK::TkCONSTANT .new(0, 1, 0, "Array"),
443+
@TK::TkDOT .new(5, 1, 5, "."),
444+
@TK::TkIDENTIFIER.new(6, 1, 6, "[]"),
445+
@TK::TkfLPAREN .new(8, 1, 8, "("),
446+
@TK::TkINTEGER .new(9, 1, 9, "1"),
447+
@TK::TkCOMMA .new(10, 1, 10, ","),
448+
@TK::TkSPACE .new(11, 1, 11, " "),
449+
@TK::TkINTEGER .new(12, 1, 12, "2"),
450+
@TK::TkRPAREN .new(13, 1, 13, ")"),
451+
@TK::TkNL .new(14, 1, 14, "\n")
452+
]
453+
454+
assert_equal expected, tokens
455+
end
456+
438457
end
439458

0 commit comments

Comments
 (0)