Skip to content

Commit 9240e88

Browse files
committed
Add test_rational_imaginary_tokenize
1 parent 3ce4743 commit 9240e88

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
@@ -418,5 +418,24 @@ def test_unary_minus
418418
assert_equal("-0.1", ruby_lex.token.value)
419419
end
420420

421+
def test_rational_imaginary_tokenize
422+
tokens = RDoc::RubyLex.tokenize '1.11r + 2.34i + 5.55ri', nil
423+
424+
expected = [
425+
@TK::TkRATIONAL .new( 0, 1, 0, '1.11r'),
426+
@TK::TkSPACE .new( 5, 1, 5, ' '),
427+
@TK::TkPLUS .new( 6, 1, 6, '+'),
428+
@TK::TkSPACE .new( 7, 1, 7, ' '),
429+
@TK::TkIMAGINARY.new( 8, 1, 8, '2.34i'),
430+
@TK::TkSPACE .new(13, 1, 13, ' '),
431+
@TK::TkPLUS .new(14, 1, 14, '+'),
432+
@TK::TkSPACE .new(15, 1, 15, ' '),
433+
@TK::TkIMAGINARY.new(16, 1, 16, '5.55ri'),
434+
@TK::TkNL .new(22, 1, 22, "\n"),
435+
]
436+
437+
assert_equal expected, tokens
438+
end
439+
421440
end
422441

0 commit comments

Comments
 (0)