summaryrefslogtreecommitdiff
path: root/spec/ruby/optional/capi/ext/object_spec.c
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2021-06-02 14:34:07 +0200
committerBenoit Daloze <eregontp@gmail.com>2021-06-02 14:34:07 +0200
commit22e2a6a999b958efe5d84d9c7314e450fda82254 (patch)
treeb2dc946cf2fe2c250d0583675e548c67dca3e71a /spec/ruby/optional/capi/ext/object_spec.c
parenta4fbc7e2884ba694278adea3b32ddb8c2ac10efe (diff)
Update to ruby/spec@a0b7d0d
Diffstat (limited to 'spec/ruby/optional/capi/ext/object_spec.c')
-rw-r--r--spec/ruby/optional/capi/ext/object_spec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/ruby/optional/capi/ext/object_spec.c b/spec/ruby/optional/capi/ext/object_spec.c
index 24f9de260e..950c081818 100644
--- a/spec/ruby/optional/capi/ext/object_spec.c
+++ b/spec/ruby/optional/capi/ext/object_spec.c
@@ -189,6 +189,11 @@ static VALUE object_spec_RTEST(VALUE self, VALUE value) {
return RTEST(value) ? Qtrue : Qfalse;
}
+static VALUE so_check_type(VALUE self, VALUE obj, VALUE other) {
+ rb_check_type(obj, TYPE(other));
+ return Qtrue;
+}
+
static VALUE so_is_type_nil(VALUE self, VALUE obj) {
if(TYPE(obj) == T_NIL) {
return Qtrue;
@@ -434,6 +439,7 @@ void Init_object_spec(void) {
rb_define_method(cls, "rb_to_id", so_to_id, 1);
rb_define_method(cls, "RTEST", object_spec_RTEST, 1);
+ rb_define_method(cls, "rb_check_type", so_check_type, 2);
rb_define_method(cls, "rb_is_type_nil", so_is_type_nil, 1);
rb_define_method(cls, "rb_is_type_object", so_is_type_object, 1);
rb_define_method(cls, "rb_is_type_array", so_is_type_array, 1);