|
1 // Ported from dom/src/json/test/unit/test_decode.js and |
|
2 // dom/src/json/test/unit/fail[1 to 34, minus 13].json |
|
3 |
|
4 testJSON('"Unterminated string literal', true); |
|
5 testJSON('["Unclosed array"', true); |
|
6 testJSON('{unquoted_key: "keys must be quoted"}', true); |
|
7 testJSON('["extra comma",]', true); |
|
8 testJSON('["double extra comma",,]', true); |
|
9 testJSON('[ , "<-- missing value"]', true); |
|
10 testJSON('["Comma after the close"],', true); |
|
11 testJSON('["Extra close"]]', true); |
|
12 testJSON('{"Extra comma": true,}', true); |
|
13 testJSON('{"Extra value after close": true} "misplaced quoted value"', true); |
|
14 testJSON('{"Illegal expression": 1 + 2}', true); |
|
15 testJSON('{"Illegal invocation": alert()}', true); |
|
16 testJSON('{"Numbers cannot be hex": 0x14}', true); |
|
17 testJSON('["Illegal backslash escape: \\x15"]', true); |
|
18 testJSON('[\\naked]', true); |
|
19 testJSON('["Illegal backslash escape: \\017"]', true); |
|
20 testJSON('{"Missing colon" null}', true); |
|
21 testJSON('{"Double colon":: null}', true); |
|
22 testJSON('{"Comma instead of colon", null}', true); |
|
23 testJSON('["Colon instead of comma": false]', true); |
|
24 testJSON('["Bad value", truth]', true); |
|
25 testJSON("['single quote']", true); |
|
26 testJSON('[" tab character in string "]', true); |
|
27 testJSON('["tab\\ character\\ in\\ string\\ "]', true); |
|
28 testJSON('["line\rbreak"]', true); |
|
29 testJSON('["line\nbreak"]', true); |
|
30 testJSON('["line\r\nbreak"]', true); |
|
31 testJSON('["line\\\rbreak"]', true); |
|
32 testJSON('["line\\\nbreak"]', true); |
|
33 testJSON('["line\\\r\nbreak"]', true); |
|
34 testJSON('[0e]', true); |
|
35 testJSON('[0e+]', true); |
|
36 testJSON('[0e+-1]', true); |
|
37 testJSON('{"Comma instead of closing brace": true,', true); |
|
38 testJSON('["mismatch"}', true); |
|
39 testJSON('0{', true); |
|
40 |
|
41 /******************************************************************************/ |
|
42 |
|
43 if (typeof reportCompare === "function") |
|
44 reportCompare(true, true); |
|
45 |
|
46 print("Tests complete"); |