travis: use hererocks for local install management
[luajson.git] / tests / lunit-nothrow-decode.lua
blobe90a5ba3d541c3652530e4cc51f8287bb3f14385
1 local json = require("json")
2 local lunit = require("lunit")
4 -- Test module for handling the simple decoding that behaves more like expected
5 if not module then
6 _ENV = lunit.module("lunit-nothrow-decode", 'seeall')
7 else
8 module("lunit-nothrow-decode", lunit.testcase, package.seeall)
9 end
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})))
17 end