diff options
| author | Li Jin <dragon-fly@qq.com> | 2026-01-30 18:16:45 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2026-01-30 18:16:45 +0800 |
| commit | 8c3d786157ec7fef3072feac55c2d5450800568b (patch) | |
| tree | 6c44a85e02abe74e6c3ccc4d7393ba8784c49ce7 /spec/outputs/test/export_import_interactions_spec.lua | |
| parent | 220a10d0df3341b2bbb0beaee4f90d6480e7ae38 (diff) | |
| download | yuescript-main.tar.gz yuescript-main.tar.bz2 yuescript-main.zip | |
Diffstat (limited to 'spec/outputs/test/export_import_interactions_spec.lua')
| -rw-r--r-- | spec/outputs/test/export_import_interactions_spec.lua | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/outputs/test/export_import_interactions_spec.lua b/spec/outputs/test/export_import_interactions_spec.lua new file mode 100644 index 0000000..774d57a --- /dev/null +++ b/spec/outputs/test/export_import_interactions_spec.lua | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | return describe("export import interactions", function() | ||
| 2 | return it("should import with alias and destructuring", function() | ||
| 3 | local source = { | ||
| 4 | origin = { | ||
| 5 | x = 10, | ||
| 6 | y = 20 | ||
| 7 | }, | ||
| 8 | target = "result", | ||
| 9 | point = { | ||
| 10 | x = 5, | ||
| 11 | y = 15 | ||
| 12 | } | ||
| 13 | } | ||
| 14 | local x, y | ||
| 15 | do | ||
| 16 | local _obj_0 = source.origin | ||
| 17 | x, y = _obj_0.x, _obj_0.y | ||
| 18 | end | ||
| 19 | local target = source.target | ||
| 20 | local px, py | ||
| 21 | do | ||
| 22 | local x, y | ||
| 23 | do | ||
| 24 | local _obj_0 = source.point | ||
| 25 | x, y = _obj_0.x, _obj_0.y | ||
| 26 | end | ||
| 27 | px, py = x, y | ||
| 28 | end | ||
| 29 | assert.same(x, 10) | ||
| 30 | assert.same(y, 20) | ||
| 31 | assert.same(target, "result") | ||
| 32 | assert.same(px, 5) | ||
| 33 | return assert.same(py, 15) | ||
| 34 | end) | ||
| 35 | end) | ||
