diff options
Diffstat (limited to 'spec/outputs/test/loops_spec.lua')
-rw-r--r-- | spec/outputs/test/loops_spec.lua | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/outputs/test/loops_spec.lua b/spec/outputs/test/loops_spec.lua new file mode 100644 index 0000000..3fc0332 --- /dev/null +++ b/spec/outputs/test/loops_spec.lua | |||
@@ -0,0 +1,39 @@ | |||
1 | return describe("loops", function() | ||
2 | return it("should continue", function() | ||
3 | local input = { | ||
4 | 1, | ||
5 | 2, | ||
6 | 3, | ||
7 | 4, | ||
8 | 5, | ||
9 | 6 | ||
10 | } | ||
11 | local output | ||
12 | do | ||
13 | local _accum_0 = { } | ||
14 | local _len_0 = 1 | ||
15 | for _index_0 = 1, #input do | ||
16 | local x = input[_index_0] | ||
17 | local _continue_0 = false | ||
18 | repeat | ||
19 | if x % 2 == 1 then | ||
20 | _continue_0 = true | ||
21 | break | ||
22 | end | ||
23 | _accum_0[_len_0] = x | ||
24 | _len_0 = _len_0 + 1 | ||
25 | _continue_0 = true | ||
26 | until true | ||
27 | if not _continue_0 then | ||
28 | break | ||
29 | end | ||
30 | end | ||
31 | output = _accum_0 | ||
32 | end | ||
33 | return assert.same(output, { | ||
34 | 2, | ||
35 | 4, | ||
36 | 6 | ||
37 | }) | ||
38 | end) | ||
39 | end) | ||