From 5051186a0b1ca74a3fbd82714f93333995ea471e Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 11 Nov 2012 06:39:08 +0000 Subject: hash.c: warn for wrong elements * hash.c (rb_hash_s_create): just warn for wrong elements now. [ruby-dev:46440] [Bug #7300] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_hash.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index 076146f5a4..01a0706c3e 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -1,5 +1,7 @@ +# -*- coding: us-ascii -*- require 'test/unit' require 'continuation' +require_relative 'envutil' class TestHash < Test::Unit::TestCase @@ -739,8 +741,8 @@ 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] } + assert_warning(/wrong element type Fixnum at 1 /) {Hash[[[1, 2], 3]]} 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 -- cgit v1.2.3