diff options
| author | Li Jin <dragon-fly@qq.com> | 2024-10-19 00:35:11 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2024-10-19 00:35:11 +0800 |
| commit | 1334c0ae67fdf4cb1377e0e7a3ef291f5cf694c0 (patch) | |
| tree | 8bd3fbeb396fd2fce6e5b34c3ee10f4923feca72 /spec/outputs/loops.lua | |
| parent | 05da3cbfa3689e6c229c41156d0dd08ab554cd77 (diff) | |
| download | yuescript-1334c0ae67fdf4cb1377e0e7a3ef291f5cf694c0.tar.gz yuescript-1334c0ae67fdf4cb1377e0e7a3ef291f5cf694c0.tar.bz2 yuescript-1334c0ae67fdf4cb1377e0e7a3ef291f5cf694c0.zip | |
Fixed issue #174.
Diffstat (limited to 'spec/outputs/loops.lua')
| -rw-r--r-- | spec/outputs/loops.lua | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/outputs/loops.lua b/spec/outputs/loops.lua index 40e27b9..8624d49 100644 --- a/spec/outputs/loops.lua +++ b/spec/outputs/loops.lua | |||
| @@ -333,3 +333,40 @@ do | |||
| 333 | ::_continue_11:: | 333 | ::_continue_11:: |
| 334 | end | 334 | end |
| 335 | end | 335 | end |
| 336 | do | ||
| 337 | repeat | ||
| 338 | local byte = stream:read_one() | ||
| 339 | if byte then | ||
| 340 | if byte == 0 then | ||
| 341 | goto _continue_13 | ||
| 342 | end | ||
| 343 | print(byte) | ||
| 344 | else | ||
| 345 | break | ||
| 346 | end | ||
| 347 | ::_continue_13:: | ||
| 348 | until false | ||
| 349 | end | ||
| 350 | do | ||
| 351 | local func | ||
| 352 | repeat | ||
| 353 | local success, result = xpcall(func, function(err) | ||
| 354 | return print(err) | ||
| 355 | end, 1, 2, 3) | ||
| 356 | if success then | ||
| 357 | print(result) | ||
| 358 | else | ||
| 359 | break | ||
| 360 | end | ||
| 361 | until false | ||
| 362 | end | ||
| 363 | do | ||
| 364 | repeat | ||
| 365 | x = func('a', b) | ||
| 366 | if not x then | ||
| 367 | print("false expected") | ||
| 368 | else | ||
| 369 | break | ||
| 370 | end | ||
| 371 | until false | ||
| 372 | end | ||
