diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/RegExp/named-groups/unicode-property-names-invalid.js')
-rw-r--r-- | js/src/tests/test262/built-ins/RegExp/named-groups/unicode-property-names-invalid.js | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/RegExp/named-groups/unicode-property-names-invalid.js b/js/src/tests/test262/built-ins/RegExp/named-groups/unicode-property-names-invalid.js new file mode 100644 index 0000000000..9b0ef33496 --- /dev/null +++ b/js/src/tests/test262/built-ins/RegExp/named-groups/unicode-property-names-invalid.js @@ -0,0 +1,57 @@ +// Copyright (C) 2020 Apple Inc. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +author: Michael Saboff +description: Invalid exotic named group names in Unicode RegExps +esid: prod-GroupSpecifier +features: [regexp-named-groups] +---*/ + +/* + Valid ID_Continue Unicode characters (Can't be first identifier character.) + + π \u{1d7da} \ud835 \udfda + + Invalid ID_Start / ID_Continue + + (fox face emoji) π¦ \u{1f98a} \ud83e \udd8a + (dog emoji) π \u{1f415} \ud83d \udc15 +*/ + +assert.throws(SyntaxError, function() { + return new RegExp("(?<π¦>fox)", "u"); +}); + +assert.throws(SyntaxError, function() { + return new RegExp("(?<\u{1f98a}>fox)", "u"); +}); + +assert.throws(SyntaxError, function() { + return new RegExp("(?<\ud83e\udd8a>fox)", "u"); +}); + +assert.throws(SyntaxError, function() { + return new RegExp("(?<π>dog)", "u"); +}); + +assert.throws(SyntaxError, function() { + return new RegExp("(?<\u{1f415}>dog)", "u"); +}); + +assert.throws(SyntaxError, function() { + return new RegExp("(?<\ud83d \udc15>dog)", "u"); +}); + +assert.throws(SyntaxError, function() { + return new RegExp("(?<πthe>the)", "u"); +}); + +assert.throws(SyntaxError, function() { + return new RegExp("(?<\u{1d7da}the>the)", "u"); +}); + +assert.throws(SyntaxError, function() { + return new RegExp("(?<\ud835\udfdathe>the)", "u"); +}); + +reportCompare(0, 0); |