From 6638b504b1ea1d092a75d02aa20674e540dd4b53 Mon Sep 17 00:00:00 2001 From: usa Date: Sun, 4 Apr 2021 23:07:45 +0000 Subject: merge revision(s) 8e189df32cacef4b21e357a590d349330532baf5: [Backport #17013] Add operator info to OP_ASGN2 of RubyVM::AbstractSyntaxTree. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_ast.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/ruby') 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 -- cgit v1.2.3