js/src/tests/ecma_5/JSON/parse-syntax-errors-03.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 // Any copyright is dedicated to the Public Domain.
michael@0 2 // http://creativecommons.org/licenses/publicdomain/
michael@0 3
michael@0 4 testJSON('[', true);
michael@0 5 testJSON('[1', true);
michael@0 6 testJSON('[1,]', true);
michael@0 7 testJSON('[1,{', true);
michael@0 8 testJSON('[1,}', true);
michael@0 9 testJSON('[1,{]', true);
michael@0 10 testJSON('[1,}]', true);
michael@0 11 testJSON('[1,{"', true);
michael@0 12 testJSON('[1,}"', true);
michael@0 13 testJSON('[1,{"\\', true);
michael@0 14 testJSON('[1,}"\\', true);
michael@0 15 testJSON('[1,"', true);
michael@0 16 testJSON('[1,"\\', true);
michael@0 17
michael@0 18 testJSON('{', true);
michael@0 19 testJSON('{1', true);
michael@0 20 testJSON('{,', true);
michael@0 21 testJSON('{"', true);
michael@0 22 testJSON('{"\\', true);
michael@0 23 testJSON('{"\\u', true);
michael@0 24 testJSON('{"\\uG', true);
michael@0 25 testJSON('{"\\u0', true);
michael@0 26 testJSON('{"\\u01', true);
michael@0 27 testJSON('{"\\u012', true);
michael@0 28 testJSON('{"\\u0123', true);
michael@0 29 testJSON('{"\\u0123"', true);
michael@0 30 testJSON('{"a"', true);
michael@0 31 testJSON('{"a"}', true);
michael@0 32 testJSON('{"a":', true);
michael@0 33 testJSON('{"a",}', true);
michael@0 34 testJSON('{"a":}', true);
michael@0 35 testJSON('{"a":,}', true);
michael@0 36 testJSON('{"a":5,}', true);
michael@0 37 testJSON('{"a":5,[', true);
michael@0 38 testJSON('{"a":5,"', true);
michael@0 39 testJSON('{"a":5,"', true);
michael@0 40 testJSON('{"a":5,"\\', true);
michael@0 41 testJSON("a[false ]".substring(1, 7) /* "[false" */, true);
michael@0 42
michael@0 43 testJSON('this', true);
michael@0 44
michael@0 45 testJSON('[1,{}]', false);
michael@0 46 testJSON('{}', false);
michael@0 47 testJSON('{"a":5}', false);
michael@0 48 testJSON('{"\\u0123":5}', false);
michael@0 49
michael@0 50 /******************************************************************************/
michael@0 51
michael@0 52 if (typeof reportCompare === "function")
michael@0 53 reportCompare(true, true);
michael@0 54
michael@0 55 print("Tests complete");

mercurial