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.
 
 
 
 
 
 

42 lines
826 B

/*
* Some invalid character class cases.
*/
/*---
{
"knownissue": "some invalid character classes are accepted (e.g. '[\\d-z]' and '[z-x]')"
}
---*/
/*===
SyntaxError
===*/
/* Should cause a SyntaxError, see E5 Section 15.10.2.15. */
try {
/* '\d' contains [0-9], while 'z' is a single character.
* CharacterRange() (E5 Section 15.10.2.15) should reject
* this with SyntaxError because both endpoints must be
* single characters.
*/
/* Note: Rhino and V8 both accept this. */
/* FIXME: there is a bug which causes us to accept this as well */
eval('t = /[\\d-z]/;');
print("no error");
} catch(e) {
print(e.name);
}
/*===
SyntaxError
===*/
/* Should cause a SyntaxError, see E5 Section 15.10.2.15. */
try {
eval('t = /[z-x]/;');
} catch(e) {
print(e.name);
}