Skip to content

Commit b57c241

Browse files
committed
Add test_class_tokenize_symbol_with_quote
1 parent d68cee2 commit b57c241

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

test/test_rdoc_ruby_lex.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,36 @@ def test_class_tokenize_symbol
558558
assert_equal expected, tokens
559559
end
560560

561+
def test_class_tokenize_symbol_with_quote
562+
tokens = RDoc::RubyLex.tokenize <<RUBY, nil
563+
a.include?()?"a":"b"
564+
{"t":1,'t2':2}
565+
RUBY
566+
567+
expected = [
568+
@TK::TkIDENTIFIER.new( 0, 1, 0, "a"),
569+
@TK::TkDOT .new( 1, 1, 1, "."),
570+
@TK::TkFID .new( 2, 1, 2, "include?"),
571+
@TK::TkLPAREN .new(10, 1, 10, "("),
572+
@TK::TkRPAREN .new(11, 1, 11, ")"),
573+
@TK::TkQUESTION .new(12, 1, 12, "?"),
574+
@TK::TkSTRING .new(13, 1, 13, "\"a\""),
575+
@TK::TkCOLON .new(16, 1, 16, ":"),
576+
@TK::TkSTRING .new(17, 1, 17, "\"b\""),
577+
@TK::TkNL .new(20, 1, 20, "\n"),
578+
@TK::TkLBRACE .new(21, 2, 0, "{"),
579+
@TK::TkSYMBOL .new(22, 2, 1, "\"t\":"),
580+
@TK::TkINTEGER .new(26, 2, 5, "1"),
581+
@TK::TkCOMMA .new(27, 2, 6, ","),
582+
@TK::TkSYMBOL .new(28, 2, 7, "'t2':"),
583+
@TK::TkINTEGER .new(33, 2, 12, "2"),
584+
@TK::TkRBRACE .new(34, 2, 13, "}"),
585+
@TK::TkNL .new(35, 2, 21, "\n"),
586+
]
587+
588+
assert_equal expected, tokens
589+
end
590+
561591
def test_unary_minus
562592
ruby_lex = RDoc::RubyLex.new("-1", nil)
563593
assert_equal("-1", ruby_lex.token.value)

0 commit comments

Comments
 (0)