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 without
2+# advancing the block param.
3+attempts = 0
4+2.downto(0) do |i|
5+ attempts += 1
6+ if i == 1 && attempts < 5
7+ redo
8+ end
9+ puts "i=#{i} attempt=#{attempts}"
10+end
11+puts "total=#{attempts}"