Skip to content

Commit cb4787f

Browse files
committed
Add test_class_tokenize_particular_kind_of_symbols
1 parent 3a6bb1f commit cb4787f

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/test_rdoc_ruby_lex.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,33 @@ def test_class_tokenize_symbol
520520
assert_equal expected, tokens
521521
end
522522

523+
def test_class_tokenize_particular_kind_of_symbols
524+
tokens = RDoc::RubyLex.tokenize '{ Thomas: :Thomas, Dave!: :Dave!, undef: :undef }', nil
525+
526+
expected = [
527+
@TK::TkLBRACE.new( 0, 1, 0, "{"),
528+
@TK::TkSPACE .new( 1, 1, 1, " "),
529+
@TK::TkSYMBOL.new( 2, 1, 2, "Thomas:"),
530+
@TK::TkSPACE .new( 9, 1, 9, " "),
531+
@TK::TkSYMBOL.new(10, 1, 10, ":Thomas"),
532+
@TK::TkCOMMA .new(17, 1, 17, ","),
533+
@TK::TkSPACE .new(18, 1, 18, " "),
534+
@TK::TkSYMBOL.new(19, 1, 19, "Dave!:"),
535+
@TK::TkSPACE .new(25, 1, 25, " "),
536+
@TK::TkSYMBOL.new(26, 1, 26, ":Dave!"),
537+
@TK::TkCOMMA .new(32, 1, 32, ","),
538+
@TK::TkSPACE .new(33, 1, 33, " "),
539+
@TK::TkSYMBOL.new(34, 1, 34, "undef:"),
540+
@TK::TkSPACE .new(40, 1, 40, " "),
541+
@TK::TkSYMBOL.new(41, 1, 41, ":undef"),
542+
@TK::TkSPACE .new(47, 1, 47, " "),
543+
@TK::TkRBRACE.new(48, 1, 48, "}"),
544+
@TK::TkNL .new(49, 1, 49, "\n"),
545+
]
546+
547+
assert_equal expected, tokens
548+
end
549+
523550
def test_unary_minus
524551
ruby_lex = RDoc::RubyLex.new("-1", nil)
525552
assert_equal("-1", ruby_lex.token.value)

0 commit comments

Comments
 (0)