summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/annexB/language/literals/regexp/identity-escape.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/annexB/language/literals/regexp/identity-escape.js')
-rw-r--r--js/src/tests/test262/annexB/language/literals/regexp/identity-escape.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/js/src/tests/test262/annexB/language/literals/regexp/identity-escape.js b/js/src/tests/test262/annexB/language/literals/regexp/identity-escape.js
new file mode 100644
index 0000000000..b1c3a53bee
--- /dev/null
+++ b/js/src/tests/test262/annexB/language/literals/regexp/identity-escape.js
@@ -0,0 +1,48 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-regular-expressions-patterns
+es6id: B.1.4
+description: Support for UnicodeIDContinue in IdentityEscape
+info: |
+ IdentityEscape[U] ::
+ [+U] SyntaxCharacter
+ [+U] /
+ [~U] SourceCharacter but not c
+---*/
+
+var match;
+
+match = /\C/.exec('ABCDE');
+assert.sameValue(match[0], 'C');
+
+match = /O\PQ/.exec('MNOPQRS');
+assert.sameValue(match[0], 'OPQ');
+
+match = /\8/.exec('789');
+assert.sameValue(match[0], '8');
+
+match = /7\89/.exec('67890');
+assert.sameValue(match[0], '789');
+
+match = /\9/.exec('890');
+assert.sameValue(match[0], '9');
+
+match = /8\90/.exec('78900');
+assert.sameValue(match[0], '890');
+
+match = /(.)(.)(.)(.)(.)(.)(.)(.)\8\8/.exec('0123456777');
+assert.sameValue(
+ match[0],
+ '0123456777',
+ 'DecimalEscape takes precedence over IdentityEscape (\\8)'
+);
+
+match = /(.)(.)(.)(.)(.)(.)(.)(.)(.)\9\9/.exec('01234567888');
+assert.sameValue(
+ match[0],
+ '01234567888',
+ 'DecimalEscape takes precedence over IdentityEscape (\\9)'
+);
+
+reportCompare(0, 0);