summaryrefslogtreecommitdiff
path: root/spec/ruby/optional/capi/proc_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/optional/capi/proc_spec.rb')
-rw-r--r--spec/ruby/optional/capi/proc_spec.rb40
1 files changed, 22 insertions, 18 deletions
diff --git a/spec/ruby/optional/capi/proc_spec.rb b/spec/ruby/optional/capi/proc_spec.rb
index 94c9276c09..bffb32484c 100644
--- a/spec/ruby/optional/capi/proc_spec.rb
+++ b/spec/ruby/optional/capi/proc_spec.rb
@@ -69,16 +69,18 @@ describe "C-API when calling Proc.new from a C function" do
# For example: C -> Ruby <- C -> Ruby means a C function called into Ruby
# code which returned to C, then C called into Ruby code again.
- # Ruby -> C -> rb_funcall(Proc.new)
- it "returns the Proc passed by the Ruby code calling the C function" do
- prc = @p.rb_Proc_new(0) { :called }
- prc.call.should == :called
- end
+ ruby_version_is ""..."2.7" do
+ # Ruby -> C -> rb_funcall(Proc.new)
+ it "returns the Proc passed by the Ruby code calling the C function" do
+ prc = @p.rb_Proc_new(0) { :called }
+ prc.call.should == :called
+ end
- # Ruby -> C -> Ruby <- C -> rb_funcall(Proc.new)
- it "returns the Proc passed to the Ruby method when the C function calls other Ruby methods before calling Proc.new" do
- prc = @p.rb_Proc_new(1) { :called }
- prc.call.should == :called
+ # Ruby -> C -> Ruby <- C -> rb_funcall(Proc.new)
+ it "returns the Proc passed to the Ruby method when the C function calls other Ruby methods before calling Proc.new" do
+ prc = @p.rb_Proc_new(1) { :called }
+ prc.call.should == :called
+ end
end
# Ruby -> C -> Ruby -> Proc.new
@@ -93,16 +95,18 @@ describe "C-API when calling Proc.new from a C function" do
lambda { @p.rb_Proc_new(3) { :called } }.should raise_error(ArgumentError)
end
- # Ruby -> C -> Ruby -> C (with new block) -> rb_funcall(Proc.new)
- it "returns the most recent Proc passed when the Ruby method called the C function" do
- prc = @p.rb_Proc_new(4) { :called }
- prc.call.should == :calling_with_block
- end
+ ruby_version_is ""..."2.7" do
+ # Ruby -> C -> Ruby -> C (with new block) -> rb_funcall(Proc.new)
+ it "returns the most recent Proc passed when the Ruby method called the C function" do
+ prc = @p.rb_Proc_new(4) { :called }
+ prc.call.should == :calling_with_block
+ end
- # Ruby -> C -> Ruby -> C (with new block) <- Ruby <- C -> # rb_funcall(Proc.new)
- it "returns the Proc passed from the original Ruby call to the C function" do
- prc = @p.rb_Proc_new(5) { :called }
- prc.call.should == :called
+ # Ruby -> C -> Ruby -> C (with new block) <- Ruby <- C -> # rb_funcall(Proc.new)
+ it "returns the Proc passed from the original Ruby call to the C function" do
+ prc = @p.rb_Proc_new(5) { :called }
+ prc.call.should == :called
+ end
end
# Ruby -> C -> Ruby -> block_given?