aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authorglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-22 00:38:05 +0000
committerglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-22 00:38:05 +0000
commit61ef7095822e24ce5983b2369fbead734109f48c (patch)
tree33bfa3d96eba43f45d7356902af2a98254cf0bee /test/ruby
parentd96152634509be95851102e7d8fee547aa4826c0 (diff)
downloadruby-61ef7095822e24ce5983b2369fbead734109f48c.tar.gz
Add arity check into Hash#flatten
* hash.c (rb_hash_flatten): add arity check git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_hash.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb
index 01b4f3a67d..813afaeee0 100644
--- a/test/ruby/test_hash.rb
+++ b/test/ruby/test_hash.rb
@@ -1118,7 +1118,12 @@ class TestHash < Test::Unit::TestCase
assert_equal([1, "one", 2, 2, "two", 3, 3, ["three"]], a.flatten(2))
assert_equal([1, "one", 2, 2, "two", 3, 3, "three"], a.flatten(3))
assert_equal([1, "one", 2, 2, "two", 3, 3, "three"], a.flatten(-1))
- assert_raise(TypeError){ a.flatten(Object) }
+ assert_raise(TypeError){ a.flatten(nil) }
+ end
+
+ def test_flatten_arity
+ a = @cls[1=> "one", 2 => [2,"two"], 3 => [3, ["three"]]]
+ assert_raise(ArgumentError){ a.flatten(1, 2) }
end
def test_callcc