michael@0: // Ported from dom/src/json/test/unit/test_decode.js and michael@0: // dom/src/json/test/unit/fail[1 to 34, minus 13].json michael@0: michael@0: testJSON('"Unterminated string literal', true); michael@0: testJSON('["Unclosed array"', true); michael@0: testJSON('{unquoted_key: "keys must be quoted"}', true); michael@0: testJSON('["extra comma",]', true); michael@0: testJSON('["double extra comma",,]', true); michael@0: testJSON('[ , "<-- missing value"]', true); michael@0: testJSON('["Comma after the close"],', true); michael@0: testJSON('["Extra close"]]', true); michael@0: testJSON('{"Extra comma": true,}', true); michael@0: testJSON('{"Extra value after close": true} "misplaced quoted value"', true); michael@0: testJSON('{"Illegal expression": 1 + 2}', true); michael@0: testJSON('{"Illegal invocation": alert()}', true); michael@0: testJSON('{"Numbers cannot be hex": 0x14}', true); michael@0: testJSON('["Illegal backslash escape: \\x15"]', true); michael@0: testJSON('[\\naked]', true); michael@0: testJSON('["Illegal backslash escape: \\017"]', true); michael@0: testJSON('{"Missing colon" null}', true); michael@0: testJSON('{"Double colon":: null}', true); michael@0: testJSON('{"Comma instead of colon", null}', true); michael@0: testJSON('["Colon instead of comma": false]', true); michael@0: testJSON('["Bad value", truth]', true); michael@0: testJSON("['single quote']", true); michael@0: testJSON('[" tab character in string "]', true); michael@0: testJSON('["tab\\ character\\ in\\ string\\ "]', true); michael@0: testJSON('["line\rbreak"]', true); michael@0: testJSON('["line\nbreak"]', true); michael@0: testJSON('["line\r\nbreak"]', true); michael@0: testJSON('["line\\\rbreak"]', true); michael@0: testJSON('["line\\\nbreak"]', true); michael@0: testJSON('["line\\\r\nbreak"]', true); michael@0: testJSON('[0e]', true); michael@0: testJSON('[0e+]', true); michael@0: testJSON('[0e+-1]', true); michael@0: testJSON('{"Comma instead of closing brace": true,', true); michael@0: testJSON('["mismatch"}', true); michael@0: testJSON('0{', true); michael@0: michael@0: /******************************************************************************/ michael@0: michael@0: if (typeof reportCompare === "function") michael@0: reportCompare(true, true); michael@0: michael@0: print("Tests complete");