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