You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
584 B

/*===
SyntaxError
===*/
/* Don't allow empty object with just comma */
try {
print(JSON.parse('[,]'));
} catch (e) {
print(e.name);
}
/*===
SyntaxError
===*/
/* Don't allow initial comma */
try {
print(JSON.parse('[,1]'));
} catch (e) {
print(e.name);
}
/*===
SyntaxError
===*/
/* Don't allow trailing comma.
*
* Rhino allows this.
*/
try {
print(JSON.parse('[1,]'));
} catch (e) {
print(e.name);
}
/*===
SyntaxError
===*/
/* Don't allow successive commas (elisions) */
try {
print(JSON.parse('[1,,2]'));
} catch (e) {
print(e.name);
}