diff options
author | nagachika <nagachika@ruby-lang.org> | 2020-09-06 11:16:29 +0900 |
---|---|---|
committer | nagachika <nagachika@ruby-lang.org> | 2020-09-06 11:16:29 +0900 |
commit | dd4e51d84e01d9c60458dfe19a0b4d4e05b55140 (patch) | |
tree | 733bc60a72f9a9c8945bb6d50960322c4cf74059 /test | |
parent | 3fef159f81fad6ffb9af5b60f4c8ec867fdb2391 (diff) |
merge revision(s) ff5e66034006a875125581114cce19d46843b32a: [Backport #17015]
Added `NODE_SPECIAL_EXCESSIVE_COMMA` info to `ARGS` of
`RubyVM::AbstractSyntaxTree`.
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_ast.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_ast.rb b/test/ruby/test_ast.rb index da7dde4a38..0d846b76e4 100644 --- a/test/ruby/test_ast.rb +++ b/test/ruby/test_ast.rb @@ -330,4 +330,19 @@ class TestAst < Test::Unit::TestCase assert_equal(:+, op) assert_equal(:VCALL, value.type) end + + def test_args + rest = 6 + node = RubyVM::AbstractSyntaxTree.parse("proc { |a| }") + _, args = *node.children.last.children[1].children + assert_equal(nil, args.children[rest]) + + node = RubyVM::AbstractSyntaxTree.parse("proc { |a,| }") + _, args = *node.children.last.children[1].children + assert_equal(:NODE_SPECIAL_EXCESSIVE_COMMA, args.children[rest]) + + node = RubyVM::AbstractSyntaxTree.parse("proc { |*a| }") + _, args = *node.children.last.children[1].children + assert_equal(:a, args.children[rest]) + end end |