Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2392b82bed7d
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 15a2e5a95ee1
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Dec 13, 2016

  1. Remove bad Proc#hash spec

    * lambda(&some_proc) just returns some_proc.
    eregon committed Dec 13, 2016
    Copy the full SHA
    93b984d View commit details
  2. Copy the full SHA
    15a2e5a View commit details
Showing with 25 additions and 5 deletions.
  1. +12 −0 spec/ruby/core/kernel/lambda_spec.rb
  2. +13 −0 spec/ruby/core/kernel/proc_spec.rb
  3. +0 −5 spec/ruby/core/proc/hash_spec.rb
12 changes: 12 additions & 0 deletions spec/ruby/core/kernel/lambda_spec.rb
Original file line number Diff line number Diff line change
@@ -11,6 +11,18 @@
Kernel.should have_private_instance_method(:lambda)
end

it "creates a lambda-style Proc if given a literal block" do
l = lambda { 42 }
l.lambda?.should be_true
end

it "returned the passed Proc if given an existing Proc" do
some_proc = proc {}
l = lambda(&some_proc)
l.should equal(some_proc)
l.lambda?.should be_false
end

it "checks the arity of the call when no args are specified" do
l = lambda { :called }
l.call.should == :called
13 changes: 13 additions & 0 deletions spec/ruby/core/kernel/proc_spec.rb
Original file line number Diff line number Diff line change
@@ -9,6 +9,19 @@
Kernel.should have_private_instance_method(:proc)
end

it "creates a proc-style Proc if given a literal block" do
l = proc { 42 }
l.lambda?.should be_false
end

it "returned the passed Proc if given an existing Proc" do
some_lambda = lambda {}
some_lambda.lambda?.should be_true
l = proc(&some_lambda)
l.should equal(some_lambda)
l.lambda?.should be_true
end

it_behaves_like(:kernel_lambda, :proc)

it "returns from the creation site of the proc, not just the proc itself" do
5 changes: 0 additions & 5 deletions spec/ruby/core/proc/hash_spec.rb
Original file line number Diff line number Diff line change
@@ -14,9 +14,4 @@
body = proc { :foo }
proc(&body).hash.should == proc(&body).hash
end

it "does not depend on whether self is a proc or lambda" do
body = proc { :foo }
proc(&body).hash.should == lambda(&body).hash
end
end