mirror of https://github.com/svaarala/duktape.git
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.
51 lines
583 B
51 lines
583 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);
|
|
}
|
|
|