summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-25 03:02:39 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-25 03:02:39 +0000
commit7d87d0c466bc742b5776f2306637a73894c402ef (patch)
treed778e467db71a7dd9ab93e984021528b3ec7c7b9 /test
parent48df48987cbab3b3ae5df1ae3ba9ba439b7443d1 (diff)
test_array.rb split flatten tests
* test/ruby/test_array.rb (test_flatten, test_flatten!): split. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_array.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb
index 75ac28d..2cec70d 100644
--- a/test/ruby/test_array.rb
+++ b/test/ruby/test_array.rb
@@ -770,14 +770,20 @@ class TestArray < Test::Unit::TestCase
assert_equal(@cls[], @cls[].flatten)
assert_equal(@cls[],
@cls[@cls[@cls[@cls[],@cls[]],@cls[@cls[]],@cls[]],@cls[@cls[@cls[]]]].flatten)
+ end
+ def test_flatten_wrong_argument
assert_raise(TypeError, "[ruby-dev:31197]") { [[]].flatten("") }
+ end
+ def test_flatten_taint
a6 = @cls[[1, 2], 3]
a6.taint
a7 = a6.flatten
assert_equal(true, a7.tainted?)
+ end
+ def test_flatten_level0
a8 = @cls[[1, 2], 3]
a9 = a8.flatten(0)
assert_equal(a8, a9)
@@ -796,11 +802,15 @@ class TestArray < Test::Unit::TestCase
assert_equal(@cls[1, 2, 3, 4, 5, 6], a5.flatten!)
assert_nil(a5.flatten!(0), '[ruby-core:23382]')
assert_equal(@cls[1, 2, 3, 4, 5, 6], a5)
+ end
+ def test_flatten_empty!
assert_nil(@cls[].flatten!)
assert_equal(@cls[],
@cls[@cls[@cls[@cls[],@cls[]],@cls[@cls[]],@cls[]],@cls[@cls[@cls[]]]].flatten!)
+ end
+ def test_flatten_level0!
assert_nil(@cls[].flatten!(0), '[ruby-core:23382]')
end