summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorChristopher Aue <[email protected]>2017-08-23 15:17:20 +0200
committerChristopher Aue <[email protected]>2017-08-23 18:15:44 +0200
commit84d8ecc1d75f0af4703e9d5fca3d740fa66d2ca1 (patch)
treecccf7c2d1c52f7f41dd53e5842ab8e9aaa897136 /test
parent4aca9ef98efc62f16d23ed1fb442e48ddbb7b51f (diff)
downloadmruby-84d8ecc1d75f0af4703e9d5fca3d740fa66d2ca1.tar.gz
mruby-84d8ecc1d75f0af4703e9d5fca3d740fa66d2ca1.zip
Fixed register windows of OP_SENDs generated by NODE_OP_ASGN; ref #3783
Diffstat (limited to 'test')
-rw-r--r--test/t/codegen.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/t/codegen.rb b/test/t/codegen.rb
index afec94a69..12c35f2b3 100644
--- a/test/t/codegen.rb
+++ b/test/t/codegen.rb
@@ -130,6 +130,33 @@ assert('register window of calls (#3783)') do
120=>120, 121=>121, 122=>122, 123=>123, 124=>124, 125=>125, 126=>126)
end
+ # NODE_OP_ASGN
+ o = Object.new
+ class << o
+ attr_accessor :a
+ end
+
+ o.a = 1
+ assert_nothing_raised{ o.a += 1 }
+ o.a = 1
+ assert_nothing_raised{ o.a <<= 1 }
+ o.a = 1
+ assert_nothing_raised{ o.a &&= 1 }
+
+ o = { k: 1 }
+ assert_nothing_raised{ o[:k] += 1 }
+ o = { k: 1 }
+ assert_nothing_raised{ o[:k] <<= 1 }
+ o = { k: 1 }
+ assert_nothing_raised{ o[:k] &&= 1 }
+
+ o = { k: 1 }
+ assert_nothing_raised{ o[*[:k]] += 1 }
+ o = { k: 1 }
+ assert_nothing_raised{ o[*[:k]] <<= 1 }
+ o = { k: 1 }
+ assert_nothing_raised{ o[*[:k]] &&= 1 }
+
# NODE_YIELD
def check_node_yield
yield