js/src/tests/ecma_5/JSON/trailing-comma.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.

     1 // Any copyright is dedicated to the Public Domain.
     2 // http://creativecommons.org/licenses/publicdomain/
     4 var gTestfile = 'trailing-comma.js';
     5 //-----------------------------------------------------------------------------
     6 var BUGNUMBER = 564621;
     7 var summary = 'JSON.parse should reject {"a" : "b",} or [1,]';
     9 print(BUGNUMBER + ": " + summary);
    11 /**************
    12  * BEGIN TEST *
    13  **************/
    15 testJSON('[]', false);
    16 testJSON('[1]', false);
    17 testJSON('["a"]', false);
    18 testJSON('{}', false);
    19 testJSON('{"a":1}', false);
    20 testJSON('{"a":"b"}', false);
    21 testJSON('{"a":true}', false);
    22 testJSON('[{}]', false);
    24 testJSON('[1,]', true);
    25 testJSON('["a",]', true);
    26 testJSON('{,}', true);
    27 testJSON('{"a":1,}', true);
    28 testJSON('{"a":"b",}', true);
    29 testJSON('{"a":true,}', true);
    30 testJSON('[{,}]', true);
    31 testJSON('[[1,]]', true);
    32 testJSON('[{"a":"b",}]', true);

mercurial