diff options
Diffstat (limited to 'spec/outputs')
| -rw-r--r-- | spec/outputs/codes_from_doc.lua | 6 | ||||
| -rw-r--r-- | spec/outputs/codes_from_doc_zh.lua | 6 | ||||
| -rw-r--r-- | spec/outputs/syntax.lua | 74 | ||||
| -rw-r--r-- | spec/outputs/unicode/syntax.lua | 4 | ||||
| -rw-r--r-- | spec/outputs/unicode/whitespace.lua | 8 | ||||
| -rw-r--r-- | spec/outputs/whitespace.lua | 8 |
6 files changed, 94 insertions, 12 deletions
diff --git a/spec/outputs/codes_from_doc.lua b/spec/outputs/codes_from_doc.lua index 1df7cef..3b0724a 100644 --- a/spec/outputs/codes_from_doc.lua +++ b/spec/outputs/codes_from_doc.lua | |||
| @@ -756,6 +756,9 @@ end | |||
| 756 | local first = select(1, ...) | 756 | local first = select(1, ...) |
| 757 | return print(ok, count, first) | 757 | return print(ok, count, first) |
| 758 | end)(fn(true)) | 758 | end)(fn(true)) |
| 759 | local a = 1 | ||
| 760 | local b = 2 | ||
| 761 | print(a + b) | ||
| 759 | Rx.Observable.fromRange(1, 8):filter(function(x) | 762 | Rx.Observable.fromRange(1, 8):filter(function(x) |
| 760 | return x % 2 == 0 | 763 | return x % 2 == 0 |
| 761 | end):concat(Rx.Observable.of('who do we appreciate')):map(function(value) | 764 | end):concat(Rx.Observable.of('who do we appreciate')):map(function(value) |
| @@ -3283,6 +3286,9 @@ end | |||
| 3283 | local first = select(1, ...) | 3286 | local first = select(1, ...) |
| 3284 | return print(ok, count, first) | 3287 | return print(ok, count, first) |
| 3285 | end)(fn(true)) | 3288 | end)(fn(true)) |
| 3289 | local a = 1 | ||
| 3290 | local b = 2 | ||
| 3291 | print(a + b) | ||
| 3286 | Rx.Observable.fromRange(1, 8):filter(function(x) | 3292 | Rx.Observable.fromRange(1, 8):filter(function(x) |
| 3287 | return x % 2 == 0 | 3293 | return x % 2 == 0 |
| 3288 | end):concat(Rx.Observable.of('who do we appreciate')):map(function(value) | 3294 | end):concat(Rx.Observable.of('who do we appreciate')):map(function(value) |
diff --git a/spec/outputs/codes_from_doc_zh.lua b/spec/outputs/codes_from_doc_zh.lua index b407895..89335c9 100644 --- a/spec/outputs/codes_from_doc_zh.lua +++ b/spec/outputs/codes_from_doc_zh.lua | |||
| @@ -756,6 +756,9 @@ end | |||
| 756 | local first = select(1, ...) | 756 | local first = select(1, ...) |
| 757 | return print(ok, count, first) | 757 | return print(ok, count, first) |
| 758 | end)(fn(true)) | 758 | end)(fn(true)) |
| 759 | local a = 1 | ||
| 760 | local b = 2 | ||
| 761 | print(a + b) | ||
| 759 | Rx.Observable.fromRange(1, 8):filter(function(x) | 762 | Rx.Observable.fromRange(1, 8):filter(function(x) |
| 760 | return x % 2 == 0 | 763 | return x % 2 == 0 |
| 761 | end):concat(Rx.Observable.of('who do we appreciate')):map(function(value) | 764 | end):concat(Rx.Observable.of('who do we appreciate')):map(function(value) |
| @@ -3277,6 +3280,9 @@ end | |||
| 3277 | local first = select(1, ...) | 3280 | local first = select(1, ...) |
| 3278 | return print(ok, count, first) | 3281 | return print(ok, count, first) |
| 3279 | end)(fn(true)) | 3282 | end)(fn(true)) |
| 3283 | local a = 1 | ||
| 3284 | local b = 2 | ||
| 3285 | print(a + b) | ||
| 3280 | Rx.Observable.fromRange(1, 8):filter(function(x) | 3286 | Rx.Observable.fromRange(1, 8):filter(function(x) |
| 3281 | return x % 2 == 0 | 3287 | return x % 2 == 0 |
| 3282 | end):concat(Rx.Observable.of('who do we appreciate')):map(function(value) | 3288 | end):concat(Rx.Observable.of('who do we appreciate')):map(function(value) |
diff --git a/spec/outputs/syntax.lua b/spec/outputs/syntax.lua index 2df3473..d975ef7 100644 --- a/spec/outputs/syntax.lua +++ b/spec/outputs/syntax.lua | |||
| @@ -5,9 +5,9 @@ func(arg1, arg2, another, arg3) | |||
| 5 | local we | 5 | local we |
| 6 | here, we = function() end, yeah | 6 | here, we = function() end, yeah |
| 7 | local the, different | 7 | local the, different |
| 8 | the, different = function() | 8 | the, different = (function() |
| 9 | return approach | 9 | return approach |
| 10 | end, yeah | 10 | end), yeah |
| 11 | dad() | 11 | dad() |
| 12 | dad(lord) | 12 | dad(lord) |
| 13 | hello(one, two)(); | 13 | hello(one, two)(); |
| @@ -441,4 +441,74 @@ do | |||
| 441 | end | 441 | end |
| 442 | end)()) | 442 | end)()) |
| 443 | end | 443 | end |
| 444 | do | ||
| 445 | a = 1 | ||
| 446 | local b = 2 | ||
| 447 | local c = a + b | ||
| 448 | print(a) | ||
| 449 | print(b) | ||
| 450 | print(c) | ||
| 451 | f = function() | ||
| 452 | a = 1 | ||
| 453 | b = 2 | ||
| 454 | return a + b | ||
| 455 | end | ||
| 456 | a = 1 | ||
| 457 | b = 2 | ||
| 458 | local success, result = pcall(function() | ||
| 459 | return func() | ||
| 460 | end) | ||
| 461 | if success then | ||
| 462 | print(result) | ||
| 463 | end | ||
| 464 | local value = "foo" | ||
| 465 | print(value) | ||
| 466 | value = value .. "bar" | ||
| 467 | print(value) | ||
| 468 | do | ||
| 469 | if ok then | ||
| 470 | print("ok!") | ||
| 471 | end | ||
| 472 | return 42 | ||
| 473 | end | ||
| 474 | for i = 1, 3 do | ||
| 475 | print(i) | ||
| 476 | goto _continue_0 | ||
| 477 | ::_continue_0:: | ||
| 478 | end | ||
| 479 | local n = 0 | ||
| 480 | while n < 2 do | ||
| 481 | print("n=", n) | ||
| 482 | n = n + 1 | ||
| 483 | end | ||
| 484 | local obj = { } | ||
| 485 | obj:set(10) | ||
| 486 | obj:get() | ||
| 487 | print("done") | ||
| 488 | do | ||
| 489 | local _with_0 = tbl | ||
| 490 | _with_0:push(1) | ||
| 491 | print("push") | ||
| 492 | end | ||
| 493 | a = 5 | ||
| 494 | if a > 3 then | ||
| 495 | print("big") | ||
| 496 | b = a * 2 | ||
| 497 | print(b) | ||
| 498 | else | ||
| 499 | print("small") | ||
| 500 | b = a | ||
| 501 | end | ||
| 502 | xpcall(function() | ||
| 503 | x = 1 | ||
| 504 | y = 2 | ||
| 505 | return print(x + y) | ||
| 506 | end, function(err) | ||
| 507 | return print("error:", err) | ||
| 508 | end) | ||
| 509 | local q = 1 | ||
| 510 | local w = 2 | ||
| 511 | local e = 3 | ||
| 512 | print(q, w, e) | ||
| 513 | end | ||
| 444 | return nil | 514 | return nil |
diff --git a/spec/outputs/unicode/syntax.lua b/spec/outputs/unicode/syntax.lua index a13302b..f5d5d8a 100644 --- a/spec/outputs/unicode/syntax.lua +++ b/spec/outputs/unicode/syntax.lua | |||
| @@ -5,9 +5,9 @@ _u51fd_u6570(_u53c2_u65701, _u53c2_u65702, _u53e6_u5916, _u53c2_u65703) | |||
| 5 | local _u6211_u4eec | 5 | local _u6211_u4eec |
| 6 | _u8fd9_u91cc, _u6211_u4eec = function() end, _u662f_u7684 | 6 | _u8fd9_u91cc, _u6211_u4eec = function() end, _u662f_u7684 |
| 7 | local _u8fd9_u4e2a, _u4e0d_u540c | 7 | local _u8fd9_u4e2a, _u4e0d_u540c |
| 8 | _u8fd9_u4e2a, _u4e0d_u540c = function() | 8 | _u8fd9_u4e2a, _u4e0d_u540c = (function() |
| 9 | return _u65b9_u6cd5 | 9 | return _u65b9_u6cd5 |
| 10 | end, _u662f_u7684 | 10 | end), _u662f_u7684 |
| 11 | _u7238_u7238() | 11 | _u7238_u7238() |
| 12 | _u7238_u7238(_u4e3b) | 12 | _u7238_u7238(_u4e3b) |
| 13 | _u4f60_u597d(_u4e00, _u4e8c)(); | 13 | _u4f60_u597d(_u4e00, _u4e8c)(); |
diff --git a/spec/outputs/unicode/whitespace.lua b/spec/outputs/unicode/whitespace.lua index d026abb..7a83d9f 100644 --- a/spec/outputs/unicode/whitespace.lua +++ b/spec/outputs/unicode/whitespace.lua | |||
| @@ -82,12 +82,12 @@ v = function() | |||
| 82 | return _u53d8_u91cfa, _u53d8_u91cfb, _u53d8_u91cfc | 82 | return _u53d8_u91cfa, _u53d8_u91cfb, _u53d8_u91cfc |
| 83 | end | 83 | end |
| 84 | local v1, v2, v3 | 84 | local v1, v2, v3 |
| 85 | v1, v2, v3 = function() | 85 | v1, v2, v3 = (function() |
| 86 | return _u53d8_u91cfa | 86 | return _u53d8_u91cfa |
| 87 | end, _u53d8_u91cfb, _u53d8_u91cfc | 87 | end), _u53d8_u91cfb, _u53d8_u91cfc |
| 88 | local _u53d8_u91cfa, _u53d8_u91cfb, _u53d8_u91cfc, _u53d8_u91cfd, _u53d8_u91cfe, _u53d8_u91cff = 1, f2({ | 88 | local _u53d8_u91cfa, _u53d8_u91cfb, _u53d8_u91cfc, _u53d8_u91cfd, _u53d8_u91cfe, _u53d8_u91cff = 1, (f2({ |
| 89 | abc = abc | 89 | abc = abc |
| 90 | }), 3, 4, _u51fd_u65705(abc), 6 | 90 | })), 3, 4, _u51fd_u65705(abc), 6 |
| 91 | for _u53d8_u91cfa, _u53d8_u91cfb, _u53d8_u91cfc in pairs(_u5bf9_u8c61tb) do | 91 | for _u53d8_u91cfa, _u53d8_u91cfb, _u53d8_u91cfc in pairs(_u5bf9_u8c61tb) do |
| 92 | _u6253_u5370(_u53d8_u91cfa, _u53d8_u91cfb, _u53d8_u91cfc) | 92 | _u6253_u5370(_u53d8_u91cfa, _u53d8_u91cfb, _u53d8_u91cfc) |
| 93 | end | 93 | end |
diff --git a/spec/outputs/whitespace.lua b/spec/outputs/whitespace.lua index 0251968..864f085 100644 --- a/spec/outputs/whitespace.lua +++ b/spec/outputs/whitespace.lua | |||
| @@ -94,12 +94,12 @@ v = function() | |||
| 94 | return a, b, c | 94 | return a, b, c |
| 95 | end | 95 | end |
| 96 | local v1, v2, v3 | 96 | local v1, v2, v3 |
| 97 | v1, v2, v3 = function() | 97 | v1, v2, v3 = (function() |
| 98 | return a | 98 | return a |
| 99 | end, b, c | 99 | end), b, c |
| 100 | local a, b, c, d, e, f = 1, f2({ | 100 | local a, b, c, d, e, f = 1, (f2({ |
| 101 | abc = abc | 101 | abc = abc |
| 102 | }), 3, 4, f5(abc), 6 | 102 | })), 3, 4, f5(abc), 6 |
| 103 | for a, b, c in pairs(tb) do | 103 | for a, b, c in pairs(tb) do |
| 104 | print(a, b, c) | 104 | print(a, b, c) |
| 105 | end | 105 | end |
