summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNobuhiro IMAI <nov@yo.rim.or.jp>2020-11-19 23:19:08 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-11-20 11:44:57 +0900
commit1800f3fa5c29515113ecdcc5695e8a96f462b74c (patch)
tree91affdf983246ba6da885448e0c23b80eef1494b /test
parent80d3f21994653186bc1bb2401b16cacebd8f9efb (diff)
Ripper.{lex,tokenize} return full tokens even if syntax error
yet another implements [Feature #17276]
Diffstat (limited to 'test')
-rw-r--r--test/ripper/test_lexer.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ripper/test_lexer.rb b/test/ripper/test_lexer.rb
index 542db2fba8..3d546c2c94 100644
--- a/test/ripper/test_lexer.rb
+++ b/test/ripper/test_lexer.rb
@@ -150,4 +150,12 @@ class TestRipper::Lexer < Test::Unit::TestCase
assert_raise(SyntaxError) { Ripper.tokenize('def req(true) end', raise_errors: true) }
assert_raise(SyntaxError) { Ripper.tokenize('def req(true) end', raise_errors: true) }
end
+
+ def test_tokenize_with_syntax_error
+ assert_equal "end", Ripper.tokenize("def req(true) end").last
+ end
+
+ def test_lex_with_syntax_error
+ assert_equal [[1, 14], :on_kw, "end", state(:EXPR_END)], Ripper.lex("def req(true) end").last
+ end
end