diff options
Diffstat (limited to 'spec/outputs/test/nil_coalescing_spec.lua')
| -rw-r--r-- | spec/outputs/test/nil_coalescing_spec.lua | 23 |
1 files changed, 23 insertions, 0 deletions
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 @@ | |||
| 1 | local _anon_func_0 = function(a, b) | ||
| 2 | if a ~= nil then | ||
| 3 | return a | ||
| 4 | else | ||
| 5 | return b | ||
| 6 | end | ||
| 7 | end | ||
| 8 | local _anon_func_1 = function(a, c) | ||
| 9 | if a ~= nil then | ||
| 10 | return a | ||
| 11 | else | ||
| 12 | return c | ||
| 13 | end | ||
| 14 | end | ||
| 15 | return describe("nil coalescing", function() | ||
| 16 | return it("distinguish nil and false", function() | ||
| 17 | local a = nil | ||
| 18 | local b = false | ||
| 19 | local c = 0 | ||
| 20 | assert.same((_anon_func_0(a, b)), false) | ||
| 21 | return assert.same((_anon_func_1(a, c)), 0) | ||
| 22 | end) | ||
| 23 | end) | ||
