diff options
Diffstat (limited to 'test')
-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 1a897ef502..3ba67e69a2 100644 --- a/test/ruby/test_ast.rb +++ b/test/ruby/test_ast.rb @@ -269,4 +269,15 @@ class TestAst < Test::Unit::TestCase assert_equal(:LIT, body.type) assert_equal([1], body.children) 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 |