summaryrefslogtreecommitdiff
path: root/spec/ruby/core/proc/block_pass_spec.rb
blob: 411c0bf3dbea32aebf1044cfdfb8e3e5bccd9c4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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