summaryrefslogtreecommitdiff
path: root/ext/-test-/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 /ext/-test-/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 'ext/-test-/typeddata')
-rw-r--r--ext/-test-/typeddata/extconf.rb1
-rw-r--r--ext/-test-/typeddata/typeddata.c20
2 files changed, 21 insertions, 0 deletions
diff --git a/ext/-test-/typeddata/extconf.rb b/ext/-test-/typeddata/extconf.rb
new file mode 100644
index 0000000..02e3e41
--- /dev/null
+++ b/ext/-test-/typeddata/extconf.rb
@@ -0,0 +1 @@
+create_makefile("-test-/typeddata/typeddata")
diff --git a/ext/-test-/typeddata/typeddata.c b/ext/-test-/typeddata/typeddata.c
new file mode 100644
index 0000000..1c5d677
--- /dev/null
+++ b/ext/-test-/typeddata/typeddata.c
@@ -0,0 +1,20 @@
+#include <ruby.h>
+
+static const rb_data_type_t test_data = {
+ "typed_data",
+};
+
+static VALUE
+test_check(VALUE self, VALUE obj)
+{
+ rb_check_typeddata(obj, &test_data);
+ return obj;
+}
+
+void
+Init_typeddata(void)
+{
+ VALUE mBug = rb_define_module("Bug");
+ VALUE klass = rb_define_class_under(mBug, "TypedData", rb_cData);
+ rb_define_singleton_method(klass, "check", test_check, 1);
+}