decoder: fixes 5.2-strict mode state object
[luajson.git] / tests / lunit-nothrow-decode.lua
blob7bf22450d934b6d01b156d0154a5184566b72664
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})))
13 end