Browse Source

testcase for nonstandard (apparently invalid) patternchar in regexp, which is still accepted by V8/Rhino

pull/1/head
Sami Vaarala 11 years ago
parent
commit
9332296081
  1. 21
      ecmascript-testcases/test-regexp-nonstandard-patternchar.js

21
ecmascript-testcases/test-regexp-nonstandard-patternchar.js

@ -0,0 +1,21 @@
/*
* V8 and Rhino both allow an unescaped brace to appear literally.
* Technically this seems to be incorrect because Ecmascript RegExp
* syntax does not allow reserved characters like '{' to appear as
* PatternCharacters.
*/
/* FIXME: this now tests V8/Rhino behavior, is this desired? */
/*===
4
===*/
try {
var re = eval("/{/");
var res = re.exec('foo {');
print(res.index);
} catch (e) {
print(e);
}
Loading…
Cancel
Save