From ce68c2bdf62a38521d63425c8826acfef39118d5 Mon Sep 17 00:00:00 2001 From: eregon Date: Mon, 27 Aug 2018 14:25:00 +0000 Subject: Update to ruby/spec@09fa86c git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- spec/ruby/optional/capi/ext/data_spec.c | 6 +++--- spec/ruby/optional/capi/struct_spec.rb | 10 +++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'spec/ruby/optional') diff --git a/spec/ruby/optional/capi/ext/data_spec.c b/spec/ruby/optional/capi/ext/data_spec.c index 52adeee59f..ac6b51b454 100644 --- a/spec/ruby/optional/capi/ext/data_spec.c +++ b/spec/ruby/optional/capi/ext/data_spec.c @@ -20,7 +20,7 @@ void sample_wrapped_struct_mark(void* st) { } VALUE sdaf_alloc_func(VALUE klass) { - struct sample_wrapped_struct* bar = (struct sample_wrapped_struct *)malloc(sizeof(struct sample_wrapped_struct)); + struct sample_wrapped_struct* bar = malloc(sizeof(struct sample_wrapped_struct)); bar->foo = 42; return Data_Wrap_Struct(klass, &sample_wrapped_struct_mark, &sample_wrapped_struct_free, bar); } @@ -33,7 +33,7 @@ VALUE sdaf_get_struct(VALUE self) { } VALUE sws_wrap_struct(VALUE self, VALUE val) { - struct sample_wrapped_struct* bar = (struct sample_wrapped_struct *)malloc(sizeof(struct sample_wrapped_struct)); + struct sample_wrapped_struct* bar = malloc(sizeof(struct sample_wrapped_struct)); bar->foo = FIX2INT(val); return Data_Wrap_Struct(rb_cObject, &sample_wrapped_struct_mark, &sample_wrapped_struct_free, bar); } @@ -59,7 +59,7 @@ VALUE sws_get_struct_data_ptr(VALUE self, VALUE obj) { VALUE sws_change_struct(VALUE self, VALUE obj, VALUE new_val) { struct sample_wrapped_struct *old_struct, *new_struct; - new_struct = (struct sample_wrapped_struct *)malloc(sizeof(struct sample_wrapped_struct)); + new_struct = malloc(sizeof(struct sample_wrapped_struct)); new_struct->foo = FIX2INT(new_val); old_struct = RDATA(obj)->data; free(old_struct); diff --git a/spec/ruby/optional/capi/struct_spec.rb b/spec/ruby/optional/capi/struct_spec.rb index 06fb189b58..b3acd02b61 100644 --- a/spec/ruby/optional/capi/struct_spec.rb +++ b/spec/ruby/optional/capi/struct_spec.rb @@ -64,7 +64,7 @@ end describe "C-API Struct function" do before :each do @s = CApiStructSpecs.new - @struct = @s.rb_struct_define_under(CApiStructSpecs, "CAPIStruct", "a", "b", "c") + @struct = @s.rb_struct_define_under(CApiStructSpecs, "CAPIStructUnder", "a", "b", "c") end describe "rb_struct_define_under" do @@ -80,11 +80,15 @@ describe "C-API Struct function" do it "has a value of nil for the member of a newly created instance" do # Verify that attributes are on an instance basis - CApiStructSpecs::CAPIStruct.new.b.should be_nil + CApiStructSpecs::CAPIStructUnder.new.b.should be_nil + end + + it "does not create a constant scoped under Struct for the named Struct" do + Struct.should_not have_constant(:CAPIStructUnder) end it "creates a constant scoped under the namespace of the given class" do - CApiStructSpecs.should have_constant(:CAPIStruct) + CApiStructSpecs.should have_constant(:CAPIStructUnder) end it "returns the member names as Symbols" do -- cgit v1.2.3