aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-14 08:08:15 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-14 08:08:15 +0000
commit8d6add973ebcb3b4c1efbfaf07786550a3e219af (patch)
tree56acd1cb74d4903170ca45655843138ce53a1937 /test/ruby
parente81c1d53feb6c65b354c9a63b9da799ce4d82026 (diff)
downloadruby-8d6add973ebcb3b4c1efbfaf07786550a3e219af.tar.gz
hash.c: raise on invalid input
* hash.c (rb_hash_s_create): raise an exception, when input elements are not one or two elements arrays. [ruby-core:39945] [Bug #5406] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_hash.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb
index 0c03bf4726..34d58a0354 100644
--- a/test/ruby/test_hash.rb
+++ b/test/ruby/test_hash.rb
@@ -712,6 +712,9 @@ class TestHash < Test::Unit::TestCase
def test_create
assert_equal({1=>2, 3=>4}, Hash[[[1,2],[3,4]]])
assert_raise(ArgumentError) { Hash[0, 1, 2] }
+ bug5406 = '[ruby-core:39945]'
+ assert_raise(ArgumentError, bug5406) { Hash[[[1, 2], 3]] }
+ assert_raise(ArgumentError, bug5406) { Hash[[[1, 2], [3, 4, 5]]] }
assert_equal({1=>2, 3=>4}, Hash[1,2,3,4])
o = Object.new
def o.to_hash() {1=>2} end