1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2019-07-27 12:40:09 +02:00
parent a06301b103
commit 5c276e1cc9
1247 changed files with 5316 additions and 5028 deletions

View file

@ -13,7 +13,7 @@ describe "The yield call" do
describe "taking no arguments" do
it "raises a LocalJumpError when the method is not passed a block" do
lambda { @y.z }.should raise_error(LocalJumpError)
-> { @y.z }.should raise_error(LocalJumpError)
end
it "ignores assignment to the explicit block argument and calls the passed block" do
@ -28,7 +28,7 @@ describe "The yield call" do
describe "taking a single argument" do
describe "when no block is given" do
it "raises a LocalJumpError" do
lambda { @y.s(1) }.should raise_error(LocalJumpError)
-> { @y.s(1) }.should raise_error(LocalJumpError)
end
end
@ -52,30 +52,30 @@ describe "The yield call" do
describe "yielding to a lambda" do
it "passes an empty Array when the argument is an empty Array" do
@y.s([], &lambda { |*a| a }).should == [[]]
@y.s([], &-> *a { a }).should == [[]]
end
it "passes nil as a value" do
@y.s(nil, &lambda { |*a| a }).should == [nil]
@y.s(nil, &-> *a { a }).should == [nil]
end
it "passes a single value" do
@y.s(1, &lambda { |*a| a }).should == [1]
@y.s(1, &-> *a { a }).should == [1]
end
it "passes a single, multi-value Array" do
@y.s([1, 2, 3], &lambda { |*a| a }).should == [[1, 2, 3]]
@y.s([1, 2, 3], &-> *a { a }).should == [[1, 2, 3]]
end
it "raises an ArgumentError if too few arguments are passed" do
lambda {
@y.s(1, &lambda { |a,b| [a,b] })
-> {
@y.s(1, &-> a, b { [a,b] })
}.should raise_error(ArgumentError)
end
it "should not destructure an Array into multiple arguments" do
lambda {
@y.s([1, 2], &lambda { |a,b| [a,b] })
-> {
@y.s([1, 2], &-> a, b { [a,b] })
}.should raise_error(ArgumentError)
end
end
@ -83,7 +83,7 @@ describe "The yield call" do
describe "taking multiple arguments" do
it "raises a LocalJumpError when the method is not passed a block" do
lambda { @y.m(1, 2, 3) }.should raise_error(LocalJumpError)
-> { @y.m(1, 2, 3) }.should raise_error(LocalJumpError)
end
it "passes the arguments to the block" do
@ -95,21 +95,21 @@ describe "The yield call" do
end
it "raises an ArgumentError if too many arguments are passed to a lambda" do
lambda {
@y.m(1, 2, 3, &lambda { |a| })
-> {
@y.m(1, 2, 3, &-> a { })
}.should raise_error(ArgumentError)
end
it "raises an ArgumentError if too few arguments are passed to a lambda" do
lambda {
@y.m(1, 2, 3, &lambda { |a,b,c,d| })
-> {
@y.m(1, 2, 3, &-> a, b, c, d { })
}.should raise_error(ArgumentError)
end
end
describe "taking a single splatted argument" do
it "raises a LocalJumpError when the method is not passed a block" do
lambda { @y.r(0) }.should raise_error(LocalJumpError)
-> { @y.r(0) }.should raise_error(LocalJumpError)
end
it "passes a single value" do
@ -141,7 +141,7 @@ describe "The yield call" do
describe "taking multiple arguments with a splat" do
it "raises a LocalJumpError when the method is not passed a block" do
lambda { @y.rs(1, 2, [3, 4]) }.should raise_error(LocalJumpError)
-> { @y.rs(1, 2, [3, 4]) }.should raise_error(LocalJumpError)
end
it "passes the arguments to the block" do
@ -166,7 +166,7 @@ describe "The yield call" do
describe "taking matching arguments with splats and post args" do
it "raises a LocalJumpError when the method is not passed a block" do
lambda { @y.rs(1, 2, [3, 4]) }.should raise_error(LocalJumpError)
-> { @y.rs(1, 2, [3, 4]) }.should raise_error(LocalJumpError)
end
it "passes the arguments to the block" do