diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-09-05 06:21:15 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-09-05 06:21:15 +0000 |
commit | b6489e214ae473de6b57900fbe9b84b226c7dfdc (patch) | |
tree | bde483db81575d91c3c2766fcb5815b75fc2a389 /test | |
parent | 47a6b4ba476fe640baad46e71b29cb410f7a27b5 (diff) | |
download | ruby-b6489e214ae473de6b57900fbe9b84b226c7dfdc.tar.gz ruby-b6489e214ae473de6b57900fbe9b84b226c7dfdc.tar.xz ruby-b6489e214ae473de6b57900fbe9b84b226c7dfdc.zip |
* compile.c (iseq_compile_each): op_asgn to aref should return rhs.
[ruby-core:25387]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_basicinstructions.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/ruby/test_basicinstructions.rb b/test/ruby/test_basicinstructions.rb index 5329828c1..36a3b2b51 100644 --- a/test/ruby/test_basicinstructions.rb +++ b/test/ruby/test_basicinstructions.rb @@ -505,6 +505,14 @@ class TestBasicInstructions < Test::Unit::TestCase :Bug1996 end Bug1996 = '[ruby-dev:39163], [ruby-core:25143]' + def [](i) + @x + end + def []=(i, x) + @x = x + :Bug2050 + end + Bug2050 = '[ruby-core:25387]' end def test_opassign2_1 @@ -575,6 +583,23 @@ class TestBasicInstructions < Test::Unit::TestCase assert_equal 4, a[0] end + def test_opassign1_2 + x = OP.new + x[0] = nil + assert_equal 1, x[0] ||= 1, OP::Bug2050 + assert_equal 1, x[0] + assert_equal 2, x[0] &&= 2, OP::Bug2050 + assert_equal 2, x[0] + assert_equal 2, x[0] ||= 3, OP::Bug2050 + assert_equal 2, x[0] + assert_equal 4, x[0] &&= 4, OP::Bug2050 + assert_equal 4, x[0] + assert_equal 5, x[0] += 1, OP::Bug2050 + assert_equal 5, x[0] + assert_equal 4, x[0] -= 1, OP::Bug2050 + assert_equal 4, x[0] + end + def test_backref /re/ =~ 'not match' assert_nil $~ |