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/nil_coalescing_spec.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 spec/outputs/test/nil_coalescing_spec.lua (limited to 'spec/outputs/test/nil_coalescing_spec.lua') diff --git a/spec/outputs/test/nil_coalescing_spec.lua b/spec/outputs/test/nil_coalescing_spec.lua new file mode 100644 index 0000000..90b2a64 --- /dev/null +++ b/spec/outputs/test/nil_coalescing_spec.lua @@ -0,0 +1,23 @@ +local _anon_func_0 = function(a, b) + if a ~= nil then + return a + else + return b + end +end +local _anon_func_1 = function(a, c) + if a ~= nil then + return a + else + return c + end +end +return describe("nil coalescing", function() + return it("distinguish nil and false", function() + local a = nil + local b = false + local c = 0 + assert.same((_anon_func_0(a, b)), false) + return assert.same((_anon_func_1(a, c)), 0) + end) +end) -- cgit v1.2.3-55-g6feb