summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-06 07:58:31 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-06 07:58:31 +0000
commit3c93a7d969e60341d993e9d116cb7f7ceb893968 (patch)
tree89169256866fbd5866866ed319a34b11466ac86a
parent118f0d1da51dd897796c985e277e78de65ddf99e (diff)
test_assignment.rb: split test_assign
* test/ruby/test_assignment.rb (test_assign): split by assignment forms. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--test/ruby/test_assignment.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_assignment.rb b/test/ruby/test_assignment.rb
index df646df4290..ebde099586a 100644
--- a/test/ruby/test_assignment.rb
+++ b/test/ruby/test_assignment.rb
@@ -17,7 +17,9 @@ class TestAssignment < Test::Unit::TestCase
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::TestCase
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::TestCase
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::TestCase
*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::TestCase
*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::TestCase
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::TestCase
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]