From f1454bbbd13a71da2005ff789cde2da0e9eb81f6 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Thu, 22 Jan 2026 15:03:12 +0800 Subject: Adding tests. --- spec/outputs/test/destructure_spec.lua | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 spec/outputs/test/destructure_spec.lua (limited to 'spec/outputs/test/destructure_spec.lua') diff --git a/spec/outputs/test/destructure_spec.lua b/spec/outputs/test/destructure_spec.lua new file mode 100644 index 0000000..4e18b02 --- /dev/null +++ b/spec/outputs/test/destructure_spec.lua @@ -0,0 +1,29 @@ +return describe("destructure", function() + return it("defaults and nested", function() + local t = { + a = 1, + b = { + c = 3 + }, + d = nil + } + local a, c, d, e = t.a, t.b.c, t.b.d, t.e + if d == nil then + d = 4 + end + if e == nil then + e = 5 + end + return assert.same({ + a, + c, + d, + e + }, { + 1, + 3, + 4, + 5 + }) + end) +end) -- cgit v1.2.3-55-g6feb