Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added specs for break, next with method.

This was fixed for return in rubinius/rubinius#1917
  • Loading branch information...
commit bbb072b183594f331d8b4fce5865d86a67a183d5 1 parent 6ea9970
@brixen brixen authored
View
5 language/break_spec.rb
@@ -163,6 +163,11 @@
a = while true; break []; end; a.should == []
a = while true; break [1]; end; a.should == [1]
end
+
+ it "passes the value returned by a method with omitted parenthesis and passed block" do
+ obj = BreakSpecs::Block.new
+ lambda { break obj.method :value do |x| x end }.call.should == :value
+ end
end
describe "with a splat" do
View
4 language/fixtures/break.rb
@@ -105,6 +105,10 @@ def break_in_yielding_method
note yielding(&b)
note :d
end
+
+ def method(v)
+ yield v
+ end
end
class Lambda < Driver
View
6 language/fixtures/next.rb
@@ -125,4 +125,10 @@ def self.loop_within_iter(arg)
end
end
end
+
+ class Block
+ def method(v)
+ yield v
+ end
+ end
end
View
5 language/next_spec.rb
@@ -99,6 +99,11 @@ def self.enclosing_method
ScratchPad.recorded.should == [
:begin, :ensure, :begin, :begin_end, :ensure, :after, :begin, :ensure]
end
+
+ 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
+ end
end
describe "The next statement" do
Please sign in to comment.
Something went wrong with that request. Please try again.