diff options
author | Li Jin <dragon-fly@qq.com> | 2022-09-13 22:31:31 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2022-09-13 22:31:31 +0800 |
commit | cb1fbac9223cc62739aa5c7bb97cba6e9dbd87c0 (patch) | |
tree | cd08fb8a717a4fb31bc800761652eec95171c0da /spec/outputs | |
parent | 27b7211e74d5677fbf5c5212264d32c7bfaffc20 (diff) | |
download | yuescript-cb1fbac9223cc62739aa5c7bb97cba6e9dbd87c0.tar.gz yuescript-cb1fbac9223cc62739aa5c7bb97cba6e9dbd87c0.tar.bz2 yuescript-cb1fbac9223cc62739aa5c7bb97cba6e9dbd87c0.zip |
fix readme.
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) |