Commit 7ccaabf5
7ccaabf5083fMerged
ydah <[email protected]> · 6 months ago · 2 files · ~2 modified
Description
test(codegen): cover while length refresh variants
Details
- Commit
- 7ccaabf5083f
- Parent
- 22ec169361cc
test/while_condition_recomputed.rbmodifiedView file
@@ -11,3 +11,45 @@
1111
1212
puts sum1313
puts items.length14+
15+
items2 = [4, 5, 6]16+
sum2 = 017+
18+
while items2.length > 019+
sum2 += items2.pop20+
end21+
22+
puts sum223+
puts items2.length24+
25+
items3 = [7, 8, 9]26+
packed = 027+
28+
while items3.length != 029+
packed = packed * 10 + items3.shift30+
end31+
32+
puts packed33+
puts items3.length34+
35+
class IvarDrain36+
def initialize37+
@items = [10, 20, 30]38+
end39+
40+
def drain41+
sum = 042+
while @items.length > 043+
sum += @items.pop44+
end45+
sum46+
end47+
48+
def remaining49+
@items.length50+
end51+
end52+
53+
drain = IvarDrain.new54+
puts drain.drain55+
puts drain.remainingtest/while_condition_recomputed.rb.expectedmodifiedView file
Loading diff…