Lines Matching refs:str
18 var str;
22 function check_parse_error (str)
25 JSON.parse (str);
32 str = ' null ';
33 assert (JSON.parse (str) === null);
34 str = 'true';
35 assert (JSON.parse (str) === true);
36 str = 'false';
37 assert (JSON.parse (str) === false);
38 str = '-32.5e002';
39 assert (JSON.parse (str) == -3250);
40 str = '"str"';
41 assert (JSON.parse (str) == "str");
42 str = '"\\b\\f\\n\\t\\r"'
43 assert (JSON.parse (str) === "\b\f\n\t\r");
45 str = '"\\u0000\\u001f"';
46 assert (JSON.parse (str) === "\x00\x1f");
47 str = '"\\ud801\\udc00\\ud801\udc00\ud801\\udc00\ud801\udc00"';
48 assert (JSON.parse (str) === "\ud801\udc00\ud801\udc00\ud801\udc00\ud801\udc00");
50 str = '"\\ud801,\\udc00,\\ud801,\udc00,\ud801,\\udc00,\ud801,\udc00"';
51 assert (JSON.parse (str) === "\ud801,\udc00,\ud801,\udc00,\ud801,\udc00,\ud801,\udc00");
63 check_parse_error ("'str'");
69 str = ' { "x": 0, "yy": null, "zzz": { "A": 4.0, "BB": { "1": 63e-1 }, "CCC" : false } } ';
70 result = JSON.parse (str);
89 str = '[{"x":[]},[[]],{}, [ null ] ]';
90 result = JSON.parse (str);
163 str = '{ "a":1, "b":2, "c": { "d":4, "e": { "f":6 } } }';
165 JSON.parse (str, toStringReviver);
168 str = '[ 32, 47, 33 ]';
170 JSON.parse (str, toStringReviver);
175 str = ' { "a":1, "b":2, "a":3 } ';
177 JSON.parse (str, toStringReviver);
180 str = ' { "a":1, "b":2, "b":3 } ';
182 JSON.parse (str, toStringReviver);
185 str = ' { "a":1, "b":{}, "b":[], "a":2, "b":3, "c":4 } ';
187 JSON.parse (str, toStringReviver);
192 str = ' { "a":1, "b":2, "c":3 } ';
193 result = JSON.parse (str, function (k, v) {
215 str = ' { "a":1, "b":2 } ';
217 result = JSON.parse (str, function (k, v) {
239 str = ' { "a":1, "b":2, "c":3 } ';
241 JSON.parse (str, function (k, v) {
265 str = ' { "a":1, "b":2 } ';
267 JSON.parse (str, function (k, v) {
282 str = ' { "a":1, "b":2 } ';
283 result = JSON.parse (str, function (k, v) {
308 str = ' { "a":1, "b":2 } ';
309 result = JSON.parse (str, function (k, v) { throw new ReferenceError("error"); } );
319 str = ' { "a":1, "b":2 } ';
320 JSON.parse (str, function (k, v) {
339 str = ' { "a":1 } ';
341 result = JSON.parse (str, 4);
344 result = JSON.parse (str, null);
347 result = JSON.parse (str, undefined);
350 result = JSON.parse (str, true);
353 result = JSON.parse (str, "foo");
358 str = ' { "a":1 } ';
360 result = JSON.parse(str, new Boolean (true));
363 result = JSON.parse(str, new String ("foo"));
366 result = JSON.parse(str, new Number (3));
369 result = JSON.parse(str, {"a": 2});
372 result = JSON.parse(str, [1, 2, 3]);