Skip to content

Commit 8b32c02

Browse files
committed
Use rb_funcallv/rb_funcallv_public in C-API specs instead of rb_funcall2/rb_funcall3
1 parent 70b0dc1 commit 8b32c02

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

spec/ruby/optional/capi/ext/kernel_spec.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ VALUE kernel_spec_call_proc_with_raised_exc(VALUE arg_array, VALUE raised_exc) {
142142

143143
argc = 2;
144144

145-
return rb_funcall2(proc, rb_intern("call"), argc, argv);
145+
return rb_funcallv(proc, rb_intern("call"), argc, argv);
146146
}
147147

148148
VALUE kernel_spec_rb_rescue(VALUE self, VALUE main_proc, VALUE arg,
@@ -318,8 +318,8 @@ static VALUE kernel_spec_rb_make_backtrace(VALUE self) {
318318
return rb_make_backtrace();
319319
}
320320

321-
static VALUE kernel_spec_rb_funcall3(VALUE self, VALUE obj, VALUE method) {
322-
return rb_funcall3(obj, SYM2ID(method), 0, NULL);
321+
static VALUE kernel_spec_rb_funcallv_public(VALUE self, VALUE obj, VALUE method) {
322+
return rb_funcallv_public(obj, SYM2ID(method), 0, NULL);
323323
}
324324

325325
static VALUE kernel_spec_rb_funcall_with_block(VALUE self, VALUE obj, VALUE method, VALUE block) {
@@ -371,7 +371,7 @@ void Init_kernel_spec(void) {
371371
rb_define_method(cls, "rb_set_end_proc", kernel_spec_rb_set_end_proc, 1);
372372
rb_define_method(cls, "rb_f_sprintf", kernel_spec_rb_f_sprintf, 1);
373373
rb_define_method(cls, "rb_make_backtrace", kernel_spec_rb_make_backtrace, 0);
374-
rb_define_method(cls, "rb_funcall3", kernel_spec_rb_funcall3, 2);
374+
rb_define_method(cls, "rb_funcallv_public", kernel_spec_rb_funcallv_public, 2);
375375
rb_define_method(cls, "rb_funcall_many_args", kernel_spec_rb_funcall_many_args, 2);
376376
rb_define_method(cls, "rb_funcall_with_block", kernel_spec_rb_funcall_with_block, 3);
377377
}

spec/ruby/optional/capi/kernel_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ def proc_caller
567567
end
568568
end
569569

570-
describe "rb_funcall3" do
570+
describe "rb_funcallv_public" do
571571
before :each do
572572
@obj = Object.new
573573
class << @obj
@@ -578,10 +578,10 @@ def method_private; :method_private end
578578
end
579579

580580
it "calls a public method" do
581-
@s.rb_funcall3(@obj, :method_public).should == :method_public
581+
@s.rb_funcallv_public(@obj, :method_public).should == :method_public
582582
end
583583
it "does not call a private method" do
584-
-> { @s.rb_funcall3(@obj, :method_private) }.should raise_error(NoMethodError, /private/)
584+
-> { @s.rb_funcallv_public(@obj, :method_private) }.should raise_error(NoMethodError, /private/)
585585
end
586586
end
587587

0 commit comments

Comments
 (0)