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

@ -8,7 +8,7 @@ describe "The next statement from within the block" do
it "ends block execution" do
a = []
lambda {
-> {
a << 1
next
a << 2
@ -17,15 +17,15 @@ describe "The next statement from within the block" do
end
it "causes block to return nil if invoked without arguments" do
lambda { 123; next; 456 }.call.should == nil
-> { 123; next; 456 }.call.should == nil
end
it "causes block to return nil if invoked with an empty expression" do
lambda { next (); 456 }.call.should be_nil
-> { next (); 456 }.call.should be_nil
end
it "returns the argument passed" do
lambda { 123; next 234; 345 }.call.should == 234
-> { 123; next 234; 345 }.call.should == 234
end
it "returns to the invoking method" do
@ -102,14 +102,14 @@ describe "The next statement from within the block" do
it "passes the value returned by a method with omitted parenthesis and passed block" do
obj = NextSpecs::Block.new
lambda { next obj.method :value do |x| x end }.call.should == :value
-> { next obj.method :value do |x| x end }.call.should == :value
end
end
describe "The next statement" do
describe "in a method" do
it "is invalid and raises a SyntaxError" do
lambda {
-> {
eval("def m; next; end")
}.should raise_error(SyntaxError)
end