diff options
| author | Andrew Konchin <andry.konchin@gmail.com> | 2025-06-02 19:34:54 +0300 |
|---|---|---|
| committer | Benoit Daloze <eregontp@gmail.com> | 2025-06-02 21:54:48 +0200 |
| commit | d6aa1714fed3e8b5ee8bede00a8853c338ff6092 (patch) | |
| tree | ea863a44d9026f74b9a07375f401c3e5d8cb4bf5 /spec/ruby/optional/capi/ext/object_spec.c | |
| parent | 685c8ca9af892f562f64b54dbee73bb9a1999b90 (diff) | |
Update to ruby/spec@4d2fc4d
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/13495
Diffstat (limited to 'spec/ruby/optional/capi/ext/object_spec.c')
| -rw-r--r-- | spec/ruby/optional/capi/ext/object_spec.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/ruby/optional/capi/ext/object_spec.c b/spec/ruby/optional/capi/ext/object_spec.c index eab0eb7534..995bc38fcf 100644 --- a/spec/ruby/optional/capi/ext/object_spec.c +++ b/spec/ruby/optional/capi/ext/object_spec.c @@ -383,6 +383,16 @@ static VALUE object_spec_custom_alloc_func_p(VALUE self, VALUE klass) { return allocator ? Qtrue : Qfalse; } +static VALUE object_spec_redefine_frozen(VALUE self) { + // The purpose of this spec is to verify that `frozen?` + // and `RB_OBJ_FROZEN` do not mutually recurse infinitely. + if (RB_OBJ_FROZEN(self)) { + return Qtrue; + } + + return Qfalse; +} + void Init_object_spec(void) { VALUE cls = rb_define_class("CApiObjectSpecs", rb_cObject); rb_define_method(cls, "FL_ABLE", object_spec_FL_ABLE, 1); @@ -455,6 +465,9 @@ void Init_object_spec(void) { rb_define_method(cls, "custom_alloc_func?", object_spec_custom_alloc_func_p, 1); rb_define_method(cls, "not_implemented_method", rb_f_notimplement, -1); rb_define_method(cls, "rb_ivar_foreach", object_spec_rb_ivar_foreach, 1); + + cls = rb_define_class("CApiObjectRedefinitionSpecs", rb_cObject); + rb_define_method(cls, "frozen?", object_spec_redefine_frozen, 0); } #ifdef __cplusplus |
