aboutsummaryrefslogtreecommitdiff
path: root/spec/outputs/test/destructure_spec.lua
blob: 4e18b020c91563da7c4beda6b3fb4ba5edcac55a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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)