diff options
| author | yui-knk <spiketeika@gmail.com> | 2022-09-25 17:53:44 +0900 |
|---|---|---|
| committer | Yuichiro Kaneko <spiketeika@gmail.com> | 2022-10-08 17:59:11 +0900 |
| commit | fbbdbdd8911ffb24d98bb71c7c33d24609ce7dfe (patch) | |
| tree | 74e11b409521113dedae0e28e7013a22e61b8c3f /test/ruby | |
| parent | 7775d14356c375536c915ea4bd0fae019acaaeb1 (diff) | |
Add error_tolerant option to RubyVM::AST
If this option is enabled, SyntaxError is not raised and Node is
returned even if passed script is broken.
[Feature #19013]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6512
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_ast.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_ast.rb b/test/ruby/test_ast.rb index d28d7e1fab..c2c5356f83 100644 --- a/test/ruby/test_ast.rb +++ b/test/ruby/test_ast.rb @@ -565,4 +565,17 @@ dummy assert_in_out_err(["-e", "def foo; end; pp RubyVM::AbstractSyntaxTree.of(method(:foo)).type"], "", [":SCOPE"], []) end + + def test_error_tolerant + node = RubyVM::AbstractSyntaxTree.parse(<<~STR, error_tolerant: true) + class A + def m + if; + a = 10 + end + end + STR + + assert_equal(:SCOPE, node.type) + end end |
