diff options
Diffstat (limited to 'spec/outputs')
| -rw-r--r-- | spec/outputs/test/loops_spec.lua | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/spec/outputs/test/loops_spec.lua b/spec/outputs/test/loops_spec.lua index 3fc0332..34f2e9c 100644 --- a/spec/outputs/test/loops_spec.lua +++ b/spec/outputs/test/loops_spec.lua | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | return describe("loops", function() | 1 | return describe("loops", function() |
| 2 | return it("should continue", function() | 2 | it("should continue", function() |
| 3 | local input = { | 3 | local input = { |
| 4 | 1, | 4 | 1, |
| 5 | 2, | 5 | 2, |
| @@ -36,4 +36,34 @@ return describe("loops", function() | |||
| 36 | 6 | 36 | 6 |
| 37 | }) | 37 | }) |
| 38 | end) | 38 | end) |
| 39 | return it("continue in repeat", function() | ||
| 40 | local output = { } | ||
| 41 | local a = 0 | ||
| 42 | repeat | ||
| 43 | local _cond_0 = false | ||
| 44 | local _continue_0 = false | ||
| 45 | repeat | ||
| 46 | a = a + 1 | ||
| 47 | if a == 3 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 | ||
| 61 | end | ||
| 62 | until _cond_0 | ||
| 63 | return assert.same(output, { | ||
| 64 | 1, | ||
| 65 | 2, | ||
| 66 | 4 | ||
| 67 | }) | ||
| 68 | end) | ||
| 39 | end) | 69 | end) |
