summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-05 01:50:18 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-05 01:50:18 +0000
commit8a9960a37412d4508b003bf0c4c5a8329ba1d6c3 (patch)
tree243313f7dbb0ae6e814ddef55335c8e1b95741dc
parent96c50e47c56fede4ef4d33c31fb30baf4df6a2e2 (diff)
* compile.c (iseq_compile_each): &&= and ||= should return rhs.
[ruby-dev:39163] (#1996), [ruby-core:25143] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--test/ruby/test_basicinstructions.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/ruby/test_basicinstructions.rb b/test/ruby/test_basicinstructions.rb
index 8da193f116..5329828c18 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