Skip to content

Commit 6517522

Browse files
committed
Add tests for % literal with the same sign of original
1 parent f216ec4 commit 6517522

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

test/test_rdoc_ruby_lex.rb

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,39 @@ def test_class_tokenize_percent_r
358358
assert_equal expected, tokens
359359
end
360360

361+
def test_class_tokenize_percent_r_with_slash
362+
tokens = RDoc::RubyLex.tokenize '%r/hi/', nil
363+
364+
expected = [
365+
@TK::TkREGEXP.new( 0, 1, 0, '%r/hi/'),
366+
@TK::TkNL .new( 6, 1, 6, "\n"),
367+
]
368+
369+
assert_equal expected, tokens
370+
end
371+
372+
def test_class_tokenize_percent_large_q
373+
tokens = RDoc::RubyLex.tokenize '%Q/hi/', nil
374+
375+
expected = [
376+
@TK::TkSTRING.new( 0, 1, 0, '%Q/hi/'),
377+
@TK::TkNL .new( 6, 1, 6, "\n"),
378+
]
379+
380+
assert_equal expected, tokens
381+
end
382+
383+
def test_class_tokenize_percent_large_q_with_double_quote
384+
tokens = RDoc::RubyLex.tokenize '%Q"hi"', nil
385+
386+
expected = [
387+
@TK::TkSTRING.new( 0, 1, 0, '%Q"hi"'),
388+
@TK::TkNL .new( 6, 1, 6, "\n"),
389+
]
390+
391+
assert_equal expected, tokens
392+
end
393+
361394
def test_class_tokenize_percent_w
362395
tokens = RDoc::RubyLex.tokenize '%w[hi]', nil
363396

0 commit comments

Comments
 (0)