Skip to content

Commit bbd4cf6

Browse files
committed
Add test_class_tokenize_reserved_keyword_with_args
1 parent 474b5ab commit bbd4cf6

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/test_rdoc_ruby_lex.rb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,31 @@ def x
101101
assert_equal expected, tokens
102102
end
103103

104+
def test_class_tokenize_reserved_keyword_with_args
105+
tokens = RDoc::RubyLex.tokenize <<-'RUBY', nil
106+
yield :foo
107+
super :bar
108+
defined? :baz
109+
RUBY
110+
111+
expected = [
112+
@TK::TkYIELD .new( 0, 1, 0, "yield"),
113+
@TK::TkSPACE .new( 5, 1, 5, " "),
114+
@TK::TkSYMBOL .new( 6, 1, 6, ":foo"),
115+
@TK::TkNL .new(10, 1, 10, "\n"),
116+
@TK::TkSUPER .new(11, 2, 0, "super"),
117+
@TK::TkSPACE .new(16, 2, 5, " "),
118+
@TK::TkSYMBOL .new(17, 2, 6, ":bar"),
119+
@TK::TkNL .new(21, 2, 11, "\n"),
120+
@TK::TkDEFINED.new(22, 3, 0, "defined?"),
121+
@TK::TkSPACE .new(30, 3, 8, " "),
122+
@TK::TkSYMBOL .new(31, 3, 9, ":baz"),
123+
@TK::TkNL .new(35, 3, 22, "\n")
124+
]
125+
126+
assert_equal expected, tokens
127+
end
128+
104129
def test_class_tokenize_hash_symbol
105130
tokens = RDoc::RubyLex.tokenize '{ class:"foo" }', nil
106131

0 commit comments

Comments
 (0)