* compile.c (iseq_compile_each): op_asgn to aref should return rhs.

[ruby-core:25387]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-09-05 06:21:15 +00:00
parent 7a05e1ead3
commit c76e698fd8
3 changed files with 56 additions and 16 deletions

View file

@ -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 $~