Commit 9355bd19
9355bd19e14cMerged
Erik Peterson <[email protected]> · 5 months ago · 12 files · +12 added
Description
test: cover loop/case control-flow codegen shapes
Adds regression and coverage tests for control-flow lowering that the suite previously did not exercise -- the gap that let two codegen bugs ship.
Regression tests (fail on the pre-fix codegen, pass after):
- control_flow_loop_cond_method_arg: a method call used as an ARGUMENT inside a while condition must be re-evaluated each iteration, not hoisted into a pre-loop temp.
- control_flow_until_cond_method_arg: same re-evaluation requirement on the until path.
- control_flow_break_in_case_in_loop: a break inside a case with integer-literal whens (lowered to a C switch) inside a loop must exit the loop, not just the switch.
Coverage tests (pass before and after; previously-untested shapes):
- control_flow_next_in_case_in_loop
- control_flow_until_modifier_method
- control_flow_while_modifier_method
Details
- Commit
- 9355bd19e14c
- Parent
- 349ff17e6875
test/control_flow_break_in_case_in_loop.rbaddedView file
1+
out = []2+
i = 03+
loop do4+
case i5+
when 36+
break7+
when 78+
break9+
end10+
out << i11+
i = i + 112+
break if i > 5013+
end14+
p outtest/control_flow_break_in_case_in_loop.rb.expectedaddedView file
Loading diff…
test/control_flow_loop_cond_method_arg.rbaddedView file
Loading diff…
test/control_flow_loop_cond_method_arg.rb.expectedaddedView file
Loading diff…
test/control_flow_next_in_case_in_loop.rbaddedView file
Loading diff…
test/control_flow_next_in_case_in_loop.rb.expectedaddedView file
Loading diff…
test/control_flow_until_cond_method_arg.rbaddedView file
Loading diff…
test/control_flow_until_cond_method_arg.rb.expectedaddedView file
Loading diff…
test/control_flow_until_modifier_method.rbaddedView file
Loading diff…
test/control_flow_until_modifier_method.rb.expectedaddedView file
Loading diff…
test/control_flow_while_modifier_method.rbaddedView file
Loading diff…
test/control_flow_while_modifier_method.rb.expectedaddedView file
Loading diff…