From fa8c30fee28f9416a8d24709748d79c98d9e54d8 Mon Sep 17 00:00:00 2001 From: Thomas Harning Jr Date: Mon, 18 Apr 2016 23:19:16 -0400 Subject: [PATCH] tests: enhances coverage for undefined and unregistered method encoding --- tests/lunit-encoding.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/lunit-encoding.lua b/tests/lunit-encoding.lua index fc8c33b..f8dff89 100644 --- a/tests/lunit-encoding.lua +++ b/tests/lunit-encoding.lua @@ -79,3 +79,13 @@ function test_custom_array() assert_equal("[]", json.encode(setmetatable({}, {__is_luajson_array = true}))) assert_equal("[]", json.encode(json.util.InitArray({}))) end + +function test_undefined() + assert_equal("[undefined]", json.encode({ json.util.undefined })) +end + +function test_unknown() + assert_error("Expected attempting to encode an unregistered function to fail", function() + json.encode({ function() end }) + end) +end -- 2.11.4.GIT