Commit c2c9583c
c2c9583c5309Merged
Ryan Seys <[email protected]> · 6 months ago · 6 files · +6 added
Description
test: cover redo in Kernel#loop, upto, and downto
Three tests pinning the Kernel#loop, Integer#upto, and Integer#downto
wrappings. redo_loop uses break if ... to terminate Kernel#loop's
otherwise-infinite body; redo_upto and redo_downto exercise the
counter-guarded redo pattern.
🤖 Generated with Claude Code
Details
- Commit
- c2c9583c5309
- Parent
- 7059580fed19
test/redo_downto.rbaddedView file
1+
# RedoNode -- `redo` inside Integer#downto: re-runs body without2+
# advancing the block param.3+
attempts = 04+
2.downto(0) do |i|5+
attempts += 16+
if i == 1 && attempts < 57+
redo8+
end9+
puts "i=#{i} attempt=#{attempts}"10+
end11+
puts "total=#{attempts}"test/redo_downto.rb.expectedaddedView file
Loading diff…
test/redo_loop.rbaddedView file
Loading diff…
test/redo_loop.rb.expectedaddedView file
Loading diff…
test/redo_upto.rbaddedView file
Loading diff…
test/redo_upto.rb.expectedaddedView file
Loading diff…