summaryrefslogtreecommitdiff
path: root/spec/ruby/core/proc/block_pass_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/proc/block_pass_spec.rb')
-rw-r--r--spec/ruby/core/proc/block_pass_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/ruby/core/proc/block_pass_spec.rb b/spec/ruby/core/proc/block_pass_spec.rb
new file mode 100644
index 0000000000..82c08db8a7
--- /dev/null
+++ b/spec/ruby/core/proc/block_pass_spec.rb
@@ -0,0 +1,21 @@
+require_relative '../../spec_helper'
+
+describe "Proc as a block pass argument" do
+ def revivify(&b)
+ b
+ end
+
+ it "remains the same object if re-vivified by the target method" do
+ p = Proc.new {}
+ p2 = revivify(&p)
+ p.should.equal? p2
+ p.should == p2
+ end
+
+ it "remains the same object if reconstructed with Proc.new" do
+ p = Proc.new {}
+ p2 = Proc.new(&p)
+ p.should.equal? p2
+ p.should == p2
+ end
+end