diff options
Diffstat (limited to 'spec/ruby/optional/capi/ext/data_spec.c')
| -rw-r--r-- | spec/ruby/optional/capi/ext/data_spec.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/ruby/optional/capi/ext/data_spec.c b/spec/ruby/optional/capi/ext/data_spec.c index 109bded1d1..efefe37c3a 100644 --- a/spec/ruby/optional/capi/ext/data_spec.c +++ b/spec/ruby/optional/capi/ext/data_spec.c @@ -3,6 +3,7 @@ #include <string.h> +#ifndef RUBY_VERSION_IS_3_4 #ifdef __cplusplus extern "C" { #endif @@ -66,7 +67,14 @@ VALUE sws_change_struct(VALUE self, VALUE obj, VALUE new_val) { return Qnil; } +VALUE sws_rb_check_type(VALUE self, VALUE obj, VALUE other) { + rb_check_type(obj, TYPE(other)); + return Qtrue; +} +#endif + void Init_data_spec(void) { +#ifndef RUBY_VERSION_IS_3_4 VALUE cls = rb_define_class("CApiAllocSpecs", rb_cObject); rb_define_alloc_func(cls, sdaf_alloc_func); rb_define_method(cls, "wrapped_data", sdaf_get_struct, 0); @@ -76,6 +84,8 @@ void Init_data_spec(void) { rb_define_method(cls, "get_struct_rdata", sws_get_struct_rdata, 1); rb_define_method(cls, "get_struct_data_ptr", sws_get_struct_data_ptr, 1); rb_define_method(cls, "change_struct", sws_change_struct, 2); + rb_define_method(cls, "rb_check_type", sws_rb_check_type, 2); +#endif } #ifdef __cplusplus |
