diff options
Diffstat (limited to '')
| -rw-r--r-- | spec/outputs/test/loops_spec.lua | 51 |
1 files changed, 17 insertions, 34 deletions
diff --git a/spec/outputs/test/loops_spec.lua b/spec/outputs/test/loops_spec.lua index 34f2e9c..9c85e1a 100644 --- a/spec/outputs/test/loops_spec.lua +++ b/spec/outputs/test/loops_spec.lua | |||
| @@ -14,56 +14,39 @@ return describe("loops", function() | |||
| 14 | local _len_0 = 1 | 14 | local _len_0 = 1 |
| 15 | for _index_0 = 1, #input do | 15 | for _index_0 = 1, #input do |
| 16 | local x = input[_index_0] | 16 | local x = input[_index_0] |
| 17 | local _continue_0 = false | 17 | if x % 2 == 1 then |
| 18 | repeat | 18 | goto _continue_0 |
| 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 | 19 | end |
| 20 | _accum_0[_len_0] = x | ||
| 21 | _len_0 = _len_0 + 1 | ||
| 22 | ::_continue_0:: | ||
| 30 | end | 23 | end |
| 31 | output = _accum_0 | 24 | output = _accum_0 |
| 32 | end | 25 | end |
| 33 | return assert.same(output, { | 26 | return assert.same({ |
| 34 | 2, | 27 | 2, |
| 35 | 4, | 28 | 4, |
| 36 | 6 | 29 | 6 |
| 37 | }) | 30 | }, output) |
| 38 | end) | 31 | end) |
| 39 | return it("continue in repeat", function() | 32 | return it("continue in repeat", function() |
| 40 | local output = { } | 33 | local output = { } |
| 41 | local a = 0 | 34 | local a = 0 |
| 42 | repeat | 35 | repeat |
| 43 | local _cond_0 = false | 36 | a = a + 1 |
| 44 | local _continue_0 = false | 37 | if a == 3 then |
| 45 | repeat | 38 | goto _continue_0 |
| 46 | a = a + 1 | 39 | end |
| 47 | if a == 3 then | 40 | if a == 5 then |
| 48 | _cond_0 = a == 8 | ||
| 49 | _continue_0 = true | ||
| 50 | break | ||
| 51 | end | ||
| 52 | if a == 5 then | ||
| 53 | break | ||
| 54 | end | ||
| 55 | output[#output + 1] = a | ||
| 56 | _cond_0 = a == 8 | ||
| 57 | _continue_0 = true | ||
| 58 | until true | ||
| 59 | if not _continue_0 then | ||
| 60 | break | 41 | break |
| 61 | end | 42 | end |
| 62 | until _cond_0 | 43 | output[#output + 1] = a |
| 63 | return assert.same(output, { | 44 | ::_continue_0:: |
| 45 | until a == 8 | ||
| 46 | return assert.same({ | ||
| 64 | 1, | 47 | 1, |
| 65 | 2, | 48 | 2, |
| 66 | 4 | 49 | 4 |
| 67 | }) | 50 | }, output) |
| 68 | end) | 51 | end) |
| 69 | end) | 52 | end) |
