diff options
| author | Li Jin <dragon-fly@qq.com> | 2021-10-12 10:04:44 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2021-10-12 10:04:44 +0800 |
| commit | 60a979e224f26117f5be82bfca757a2483cef0fd (patch) | |
| tree | 7c6af44f6dcada1f23979b820ba830251997b161 /spec/outputs/do.lua | |
| parent | a19b242cbaf53721b20a3163dd06f43e9ef2b487 (diff) | |
| download | yuescript-60a979e224f26117f5be82bfca757a2483cef0fd.tar.gz yuescript-60a979e224f26117f5be82bfca757a2483cef0fd.tar.bz2 yuescript-60a979e224f26117f5be82bfca757a2483cef0fd.zip | |
fix test.
Diffstat (limited to 'spec/outputs/do.lua')
| -rw-r--r-- | spec/outputs/do.lua | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/spec/outputs/do.lua b/spec/outputs/do.lua new file mode 100644 index 0000000..96d1022 --- /dev/null +++ b/spec/outputs/do.lua | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | do | ||
| 2 | print("hello") | ||
| 3 | print("world") | ||
| 4 | end | ||
| 5 | local x | ||
| 6 | do | ||
| 7 | print("hello") | ||
| 8 | x = print("world") | ||
| 9 | end | ||
| 10 | local y | ||
| 11 | do | ||
| 12 | local things = "shhh" | ||
| 13 | y = function() | ||
| 14 | return "hello: " .. things | ||
| 15 | end | ||
| 16 | end | ||
| 17 | local _ | ||
| 18 | _ = function() | ||
| 19 | if something then | ||
| 20 | do | ||
| 21 | return "yeah" | ||
| 22 | end | ||
| 23 | end | ||
| 24 | end | ||
| 25 | local t = { | ||
| 26 | y = (function() | ||
| 27 | local number = 100 | ||
| 28 | return function(x) | ||
| 29 | return x + number | ||
| 30 | end | ||
| 31 | end)() | ||
| 32 | } | ||
| 33 | return function(y, k) | ||
| 34 | if y == nil then | ||
| 35 | y = ((function() | ||
| 36 | x = 10 + 2 | ||
| 37 | return x | ||
| 38 | end)()) | ||
| 39 | end | ||
| 40 | if k == nil then | ||
| 41 | do | ||
| 42 | k = "nothing" | ||
| 43 | end | ||
| 44 | end | ||
| 45 | do | ||
| 46 | return "uhhh" | ||
| 47 | end | ||
| 48 | end | ||
