1 local json
= require("json")
2 local lunit
= require("lunit")
4 -- Test module for handling the simple decoding that behaves more like expected
5 module("lunit-nothrow-decode", lunit
.testcase
, package
.seeall
)
7 function test_decode_nothrow_bad_data()
8 assert_nil((json
.decode('x', {nothrow
= true})))
9 assert_nil((json
.decode('{x:x}', {nothrow
= true})))
10 assert_nil((json
.decode('[x:x]', {nothrow
= true})))
11 assert_nil((json
.decode('[1.fg]', {nothrow
= true})))
12 assert_nil((json
.decode('["\\xzz"]', {nothrow
= true})))