From c34e9f23aa2b6909e92623710e91cd99eaff2dc3 Mon Sep 17 00:00:00 2001 From: marcandre Date: Tue, 29 Jan 2013 22:00:58 +0000 Subject: * object.c: Improve error for failed implicit conversions [Bug #7539] * error.c: Adapt rdoc * test/ruby/test_object.rb: Test for above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_object.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_object.rb b/test/ruby/test_object.rb index 9f0e9bc5b2..9787525bce 100644 --- a/test/ruby/test_object.rb +++ b/test/ruby/test_object.rb @@ -885,4 +885,12 @@ class TestObject < Test::Unit::TestCase assert_not_initialize_copy {st.new} assert_not_initialize_copy {Time.now} end + + def test_type_error_message + issue = "Bug #7539" + err = assert_raise(TypeError){ Integer([42]) } + assert_equal "can't convert Array into Integer", err.message, issue + err = assert_raise(TypeError){ [].first([42]) } + assert_equal 'no implicit conversion of Array into Integer', err.message, issue + end end -- cgit v1.2.3