diff options
author | Nobuyoshi Nakada <[email protected]> | 2024-06-07 14:15:05 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2024-06-07 14:15:05 +0900 |
commit | 5f6a4ed5074eda4b4b1bd2d6dd29aaf3b8ef879d (patch) | |
tree | 0b29f76b2711d674544aed40e1ba02bb3ba32fe4 | |
parent | a279463d0ebb2fe1d4021ddd4675141deead514b (diff) |
Remove the old untyped Data API in spec/ruby
-rw-r--r-- | spec/ruby/optional/capi/data_spec.rb | 3 | ||||
-rw-r--r-- | spec/ruby/optional/capi/ext/data_spec.c | 4 | ||||
-rw-r--r-- | spec/ruby/optional/capi/ext/rubyspec.h | 4 | ||||
-rw-r--r-- | spec/ruby/optional/capi/ext/typed_data_spec.c | 2 | ||||
-rw-r--r-- | spec/ruby/optional/capi/rbasic_spec.rb | 8 |
5 files changed, 20 insertions, 1 deletions
diff --git a/spec/ruby/optional/capi/data_spec.rb b/spec/ruby/optional/capi/data_spec.rb index 18c769332e..5860035715 100644 --- a/spec/ruby/optional/capi/data_spec.rb +++ b/spec/ruby/optional/capi/data_spec.rb @@ -1,4 +1,7 @@ require_relative 'spec_helper' +ruby_version_is "3.4" do + return +end load_extension("data") diff --git a/spec/ruby/optional/capi/ext/data_spec.c b/spec/ruby/optional/capi/ext/data_spec.c index ef069ef0ba..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 @@ -70,8 +71,10 @@ 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); @@ -82,6 +85,7 @@ void Init_data_spec(void) { 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 diff --git a/spec/ruby/optional/capi/ext/rubyspec.h b/spec/ruby/optional/capi/ext/rubyspec.h index 09135774af..1df274ead1 100644 --- a/spec/ruby/optional/capi/ext/rubyspec.h +++ b/spec/ruby/optional/capi/ext/rubyspec.h @@ -46,6 +46,10 @@ (RUBY_VERSION_MAJOR == (major) && RUBY_VERSION_MINOR == (minor) && RUBY_VERSION_TEENY < (teeny))) #define RUBY_VERSION_SINCE(major,minor,teeny) (!RUBY_VERSION_BEFORE(major, minor, teeny)) +#if RUBY_VERSION_SINCE(3, 4, 0) +#define RUBY_VERSION_IS_3_4 +#endif + #if RUBY_VERSION_SINCE(3, 3, 0) #define RUBY_VERSION_IS_3_3 #endif diff --git a/spec/ruby/optional/capi/ext/typed_data_spec.c b/spec/ruby/optional/capi/ext/typed_data_spec.c index 38889ecf5c..221f1c8ac4 100644 --- a/spec/ruby/optional/capi/ext/typed_data_spec.c +++ b/spec/ruby/optional/capi/ext/typed_data_spec.c @@ -106,6 +106,8 @@ VALUE sws_typed_wrap_struct(VALUE self, VALUE val) { return TypedData_Wrap_Struct(rb_cObject, &sample_typed_wrapped_struct_data_type, bar); } +#undef RUBY_UNTYPED_DATA_WARNING +#define RUBY_UNTYPED_DATA_WARNING 0 VALUE sws_untyped_wrap_struct(VALUE self, VALUE val) { int* data = (int*) malloc(sizeof(int)); *data = FIX2INT(val); diff --git a/spec/ruby/optional/capi/rbasic_spec.rb b/spec/ruby/optional/capi/rbasic_spec.rb index f3367e05ff..e2fda782f5 100644 --- a/spec/ruby/optional/capi/rbasic_spec.rb +++ b/spec/ruby/optional/capi/rbasic_spec.rb @@ -1,7 +1,9 @@ require_relative 'spec_helper' require_relative 'shared/rbasic' load_extension("rbasic") -load_extension("data") +ruby_version_is ""..."3.4" do + load_extension("data") +end load_extension("array") describe "RBasic support for regular objects" do @@ -12,6 +14,10 @@ describe "RBasic support for regular objects" do it_should_behave_like :rbasic end +ruby_version_is "3.4" do + return +end + describe "RBasic support for RData" do before :all do @specs = CApiRBasicRDataSpecs.new |