diff options
| author | Li Jin <dragon-fly@qq.com> | 2026-01-28 18:43:14 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2026-01-28 18:43:14 +0800 |
| commit | dd64edd58fe25ec74ae5958128cf3f74b0692f3b (patch) | |
| tree | 0f2de1df55897e2713977c5a53936757e14b477a /spec/outputs/test/named_varargs_spec.lua | |
| parent | 7c2a92b82e9808d3c5ea29b47d1c59d663fe984a (diff) | |
| download | yuescript-dd64edd58fe25ec74ae5958128cf3f74b0692f3b.tar.gz yuescript-dd64edd58fe25ec74ae5958128cf3f74b0692f3b.tar.bz2 yuescript-dd64edd58fe25ec74ae5958128cf3f74b0692f3b.zip | |
Fixed compiler issues and added 800+ test cases.
Diffstat (limited to 'spec/outputs/test/named_varargs_spec.lua')
| -rw-r--r-- | spec/outputs/test/named_varargs_spec.lua | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/spec/outputs/test/named_varargs_spec.lua b/spec/outputs/test/named_varargs_spec.lua index 2a71cea..be35b22 100644 --- a/spec/outputs/test/named_varargs_spec.lua +++ b/spec/outputs/test/named_varargs_spec.lua | |||
| @@ -187,21 +187,19 @@ return describe("named varargs", function() | |||
| 187 | }) | 187 | }) |
| 188 | end) | 188 | end) |
| 189 | it("should support passing named varargs to another function", function() | 189 | it("should support passing named varargs to another function", function() |
| 190 | local inner | ||
| 191 | inner = function(...) | ||
| 192 | return { | ||
| 193 | ... | ||
| 194 | } | ||
| 195 | end | ||
| 190 | local outer | 196 | local outer |
| 191 | outer = function(...) | 197 | outer = function(...) |
| 192 | local t = { | 198 | local t = { |
| 193 | n = select("#", ...), | 199 | n = select("#", ...), |
| 194 | ... | 200 | ... |
| 195 | } | 201 | } |
| 196 | return inner((table.unpack(t))) | 202 | return inner(t[1], t[2], t[3]) |
| 197 | end | ||
| 198 | local inner | ||
| 199 | inner = function(a, b, c) | ||
| 200 | return { | ||
| 201 | a, | ||
| 202 | b, | ||
| 203 | c | ||
| 204 | } | ||
| 205 | end | 203 | end |
| 206 | local result = outer(1, 2, 3) | 204 | local result = outer(1, 2, 3) |
| 207 | return assert.same(result, { | 205 | return assert.same(result, { |
