ruby-changes:34282
From: nobu <ko1@a...>
Date: Fri, 6 Jun 2014 16:58:39 +0900 (JST)
Subject: [ruby-changes:34282] nobu:r46363 (trunk): test_assignment.rb: split test_assign
nobu 2014-06-06 16:58:31 +0900 (Fri, 06 Jun 2014) New Revision: 46363 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46363 Log: test_assignment.rb: split test_assign * test/ruby/test_assignment.rb (test_assign): split by assignment forms. Modified files: trunk/test/ruby/test_assignment.rb Index: test/ruby/test_assignment.rb =================================================================== --- test/ruby/test_assignment.rb (revision 46362) +++ test/ruby/test_assignment.rb (revision 46363) @@ -17,7 +17,9 @@ class TestAssignment < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/ruby/test_assignment.rb#L17 cc = 5 cc &&=44 assert_equal(44, cc) + end + def test_assign_simple a = nil; assert_nil(a) a = 1; assert_equal(1, a) a = []; assert_equal([], a) @@ -28,7 +30,9 @@ class TestAssignment < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/ruby/test_assignment.rb#L30 a = [*[]]; assert_equal([], a) a = [*[1]]; assert_equal([1], a) a = [*[1,2]]; assert_equal([1,2], a) + end + def test_assign_splat a = *[]; assert_equal([], a) a = *[1]; assert_equal([1], a) a = *[nil]; assert_equal([nil], a) @@ -37,7 +41,9 @@ class TestAssignment < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/ruby/test_assignment.rb#L41 a = *[*[]]; assert_equal([], a) a = *[*[1]]; assert_equal([1], a) a = *[*[1,2]]; assert_equal([1,2], a) + end + def test_assign_ary *a = nil; assert_equal([nil], a) *a = 1; assert_equal([1], a) *a = []; assert_equal([], a) @@ -48,7 +54,9 @@ class TestAssignment < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/ruby/test_assignment.rb#L54 *a = [*[]]; assert_equal([], a) *a = [*[1]]; assert_equal([1], a) *a = [*[1,2]]; assert_equal([1,2], a) + end + def test_assign_ary_splat *a = *[]; assert_equal([], a) *a = *[1]; assert_equal([1], a) *a = *[nil]; assert_equal([nil], a) @@ -57,7 +65,9 @@ class TestAssignment < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/ruby/test_assignment.rb#L65 *a = *[*[]]; assert_equal([], a) *a = *[*[1]]; assert_equal([1], a) *a = *[*[1,2]]; assert_equal([1,2], a) + end + def test_massign_simple a,b,*c = nil; assert_equal([nil,nil,[]], [a,b,c]) a,b,*c = 1; assert_equal([1,nil,[]], [a,b,c]) a,b,*c = []; assert_equal([nil,nil,[]], [a,b,c]) @@ -68,7 +78,9 @@ class TestAssignment < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/ruby/test_assignment.rb#L78 a,b,*c = [*[]]; assert_equal([nil,nil,[]], [a,b,c]) a,b,*c = [*[1]]; assert_equal([1,nil,[]], [a,b,c]) a,b,*c = [*[1,2]]; assert_equal([1,2,[]], [a,b,c]) + end + def test_massign_splat a,b,*c = *[]; assert_equal([nil,nil,[]], [a,b,c]) a,b,*c = *[1]; assert_equal([1,nil,[]], [a,b,c]) a,b,*c = *[nil]; assert_equal([nil,nil,[]], [a,b,c]) @@ -77,7 +89,9 @@ class TestAssignment < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/test/ruby/test_assignment.rb#L89 a,b,*c = *[*[]]; assert_equal([nil,nil,[]], [a,b,c]) a,b,*c = *[*[1]]; assert_equal([1,nil,[]], [a,b,c]) a,b,*c = *[*[1,2]]; assert_equal([1,2,[]], [a,b,c]) + end + def test_assign_abbreviated bug2050 = '[ruby-core:25629]' a = Hash.new {[]} b = [1, 2] -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/