diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-09-05 01:50:18 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-09-05 01:50:18 +0000 |
| commit | 48fa7ac183e0921663140f11bfb98bf44bda080a (patch) | |
| tree | 243313f7dbb0ae6e814ddef55335c8e1b95741dc /test/ruby/test_basicinstructions.rb | |
| parent | a5737e58a7d5f2ae861a80c8216e027940ca87f7 (diff) | |
| download | ruby-48fa7ac183e0921663140f11bfb98bf44bda080a.tar.gz ruby-48fa7ac183e0921663140f11bfb98bf44bda080a.tar.xz ruby-48fa7ac183e0921663140f11bfb98bf44bda080a.zip | |
* compile.c (iseq_compile_each): &&= and ||= should return rhs.
[ruby-dev:39163] (#1996), [ruby-core:25143]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_basicinstructions.rb')
| -rw-r--r-- | test/ruby/test_basicinstructions.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/test/ruby/test_basicinstructions.rb b/test/ruby/test_basicinstructions.rb index 8da193f11..5329828c1 100644 --- a/test/ruby/test_basicinstructions.rb +++ b/test/ruby/test_basicinstructions.rb @@ -507,7 +507,7 @@ class TestBasicInstructions < Test::Unit::TestCase Bug1996 = '[ruby-dev:39163], [ruby-core:25143]' end - def test_opassign + def test_opassign2_1 x = nil assert_equal 1, x ||= 1 assert_equal 1, x @@ -521,7 +521,9 @@ class TestBasicInstructions < Test::Unit::TestCase assert_equal 5, x assert_equal 4, x -= 1 assert_equal 4, x + end + def test_opassign2_2 y = OP.new y.x = nil assert_equal 1, y.x ||= 1, OP::Bug1996 @@ -536,9 +538,11 @@ class TestBasicInstructions < Test::Unit::TestCase assert_equal 5, y.x assert_equal 4, y.x -= 1, OP::Bug1996 assert_equal 4, y.x + end + def test_opassign2_3 z = OP.new - z.x = y + z.x = OP.new z.x.x = nil assert_equal 1, z.x.x ||= 1, OP::Bug1996 assert_equal 1, z.x.x @@ -552,7 +556,9 @@ class TestBasicInstructions < Test::Unit::TestCase assert_equal 5, z.x.x assert_equal 4, z.x.x -= 1, OP::Bug1996 assert_equal 4, z.x.x + end + def test_opassign1_1 a = [] a[0] = nil assert_equal 1, a[0] ||= 1 |
