diff options
author | nagachika <nagachika@ruby-lang.org> | 2020-08-07 20:16:51 +0900 |
---|---|---|
committer | nagachika <nagachika@ruby-lang.org> | 2020-08-07 20:16:51 +0900 |
commit | e9e4f8430a62f56a4e62dd728f4498ee4c300c12 (patch) | |
tree | d3614c21b297a73abf1d0e584d5a4baabe546c33 /test/ruby/test_ast.rb | |
parent | 23d130a9ddcaf766d6ce309f8518b434a2537fc1 (diff) |
merge revision(s) 8e189df32cacef4b21e357a590d349330532baf5: [Backport #17013]
Add operator info to `OP_ASGN2` of `RubyVM::AbstractSyntaxTree`.
Diffstat (limited to 'test/ruby/test_ast.rb')
-rw-r--r-- | test/ruby/test_ast.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/ruby/test_ast.rb b/test/ruby/test_ast.rb index 147d05eadf..da7dde4a38 100644 --- a/test/ruby/test_ast.rb +++ b/test/ruby/test_ast.rb @@ -319,4 +319,15 @@ class TestAst < Test::Unit::TestCase helper.validate_range assert_equal([], helper.errors) end + + def test_op_asgn2 + node = RubyVM::AbstractSyntaxTree.parse("struct.field += foo") + _, _, body = *node.children + assert_equal(:OP_ASGN2, body.type) + recv, _, mid, op, value = body.children + assert_equal(:VCALL, recv.type) + assert_equal(:field, mid) + assert_equal(:+, op) + assert_equal(:VCALL, value.type) + end end |