Skip to content

Commit ba17b3d

Browse files
committed
Spec for the new behavior of Kernel#loop
1 parent f59a862 commit ba17b3d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

core/kernel/loop_spec.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,17 @@
6060
lambda{ loop do raise StandardError end }.should raise_error( StandardError )
6161
end
6262

63+
ruby_version_is "2.3" do
64+
it "returns StopIteration#result, the result value of a finished iterator" do
65+
e = Enumerator.new { |y|
66+
y << 1
67+
y << 2
68+
:stopped
69+
}
70+
loop { e.next }.should == :stopped
71+
end
72+
end
73+
6374
describe "when no block is given" do
6475
describe "returned Enumerator" do
6576
describe "size" do

0 commit comments

Comments
 (0)