summaryrefslogtreecommitdiff
path: root/test/-ext-/typeddata
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-12-15 05:33:34 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-12-15 05:33:34 +0000
commit9dccfb5513d6344b1fd113c403255b44c486fc3e (patch)
tree64b1ba351170634981de284ff29aa3859a9def16 /test/-ext-/typeddata
parent57537ccb0ef8ccd644e0ca4196aebb834970f3f8 (diff)
* error.c (rb_check_typeddata): refine error message with
including expected struct name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/-ext-/typeddata')
-rw-r--r--test/-ext-/typeddata/test_typeddata.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/-ext-/typeddata/test_typeddata.rb b/test/-ext-/typeddata/test_typeddata.rb
new file mode 100644
index 00000000000..50505850d83
--- /dev/null
+++ b/test/-ext-/typeddata/test_typeddata.rb
@@ -0,0 +1,21 @@
+require 'test/unit'
+require "-test-/typeddata/typeddata"
+
+class Test_TypedData < Test::Unit::TestCase
+ def test_wrong_argtype
+ e = assert_raise(TypeError) {Bug::TypedData.check(false)}
+ assert_equal("wrong argument type false (expected typed_data)", e.message)
+
+ e = assert_raise(TypeError) {Bug::TypedData.check(true)}
+ assert_equal("wrong argument type true (expected typed_data)", e.message)
+
+ e = assert_raise(TypeError) {Bug::TypedData.check(:e)}
+ assert_equal("wrong argument type Symbol (expected typed_data)", e.message)
+
+ e = assert_raise(TypeError) {Bug::TypedData.check(0)}
+ assert_equal("wrong argument type Fixnum (expected typed_data)", e.message)
+
+ e = assert_raise(TypeError) {Bug::TypedData.check("a")}
+ assert_equal("wrong argument type String (expected typed_data)", e.message)
+ end
+end