ruby-changes:13013
From: nobu <ko1@a...>
Date: Sat, 5 Sep 2009 10:50:41 +0900 (JST)
Subject: [ruby-changes:13013] Ruby:r24758 (trunk): * compile.c (iseq_compile_each): &&= and ||= should return rhs.
nobu 2009-09-05 10:50:18 +0900 (Sat, 05 Sep 2009) New Revision: 24758 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=24758 Log: * compile.c (iseq_compile_each): &&= and ||= should return rhs. [ruby-dev:39163] (#1996), [ruby-core:25143] Modified files: trunk/test/ruby/test_basicinstructions.rb Index: test/ruby/test_basicinstructions.rb =================================================================== --- test/ruby/test_basicinstructions.rb (revision 24757) +++ test/ruby/test_basicinstructions.rb (revision 24758) @@ -507,7 +507,7 @@ 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 @@ 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 @@ 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 @@ 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/