From e80d8a184ad065d7f1457354dc2d42665fd4a846 Mon Sep 17 00:00:00 2001 From: Kevin Gibbons <kevin@shapesecurity.com> Date: Mon, 5 Nov 2018 15:34:03 -0800 Subject: [PATCH] split unicode-property-names.js --- .../named-groups/unicode-property-names.js | 18 ------------------ ...valid-non-id-continue-groupspecifier-4-u.js | 15 +++++++++++++++ .../invalid-non-id-start-groupspecifier-2-u.js | 15 +++++++++++++++ .../invalid-non-id-start-groupspecifier-4-u.js | 15 +++++++++++++++ .../invalid-non-id-start-groupspecifier-5-u.js | 15 +++++++++++++++ .../invalid-non-id-start-groupspecifier-8-u.js | 15 +++++++++++++++ .../invalid-non-id-start-groupspecifier-9-u.js | 15 +++++++++++++++ .../invalid-non-id-start-groupspecifier-u.js | 15 +++++++++++++++ 8 files changed, 105 insertions(+), 18 deletions(-) create mode 100644 test/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4-u.js create mode 100644 test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2-u.js create mode 100644 test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4-u.js create mode 100644 test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5-u.js create mode 100644 test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8-u.js create mode 100644 test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-9-u.js create mode 100644 test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-u.js diff --git a/test/built-ins/RegExp/named-groups/unicode-property-names.js b/test/built-ins/RegExp/named-groups/unicode-property-names.js index 24e4a6ade9..c12df27828 100644 --- a/test/built-ins/RegExp/named-groups/unicode-property-names.js +++ b/test/built-ins/RegExp/named-groups/unicode-property-names.js @@ -17,30 +17,12 @@ assert.sameValue("a", /(?<$𐒤>a)/u.exec("bab").groups.$𐒤); assert.sameValue("a", /(?<_\u200C>a)/u.exec("bab").groups._\u200C); assert.sameValue("a", /(?<_\u200D>a)/u.exec("bab").groups._\u200D); assert.sameValue("a", /(?<ಠ_ಠ>a)/u.exec("bab").groups.ಠ_ಠ); -assert.throws(SyntaxError, () => eval('/(?<❤>a)/u')); -assert.throws(SyntaxError, () => eval('/(?<𐒤>a)/u'), "ID_Continue but not ID_Start."); // Unicode escapes in capture names. assert(/(?<a\uD801\uDCA4>.)/u.test("a"), "\\u Lead \\u Trail"); -assert.throws(SyntaxError, () => eval("/(?<a\\uD801>.)/u"), "\\u Lea"); -assert.throws(SyntaxError, () => eval("/(?<a\\uDCA4>.)/u"), "\\u Trai"); assert(/(?<\u0041>.)/u.test("a"), "\\u NonSurrogate"); assert(/(?<\u{0041}>.)/u.test("a"), "\\u{ Non-surrogate }"); assert(/(?<a\u{104A4}>.)/u.test("a"), "\\u{ Surrogate, ID_Continue }"); -assert.throws(SyntaxError, () => eval("/(?<a\\u{110000}>.)/u"), "\\u{ Out-of-bounds "); -assert.throws(SyntaxError, () => eval("/(?<a\uD801>.)/u"), "Lea"); -assert.throws(SyntaxError, () => eval("/(?<a\uDCA4>.)/u"), "Trai"); -assert(RegExp("(?<\u{0041}>.)", "u").test("a"), "Non-surrogate"); -assert(RegExp("(?<a\u{104A4}>.)", "u").test("a"), "Surrogate,ID_Continue"); - -// Bracketed escapes are not allowed; -// 4-char escapes must be the proper ID_Start/ID_Continue -assert.throws(SyntaxError, () => eval("/(?<a\\uD801>.)/u"), "Lead"); -assert.throws(SyntaxError, () => eval("/(?<a\\uDCA4>.)/u"), "Trail"); assert((/(?<\u{0041}>.)/u).test("a"), "Non-surrogate"); assert(/(?<a\u{104A4}>.)/u.test("a"), "Surrogate, ID_Continue"); assert(RegExp("(?<\\u0041>.)", "u").test("a"), "Non-surrogate"); - -// Backslash is not allowed as ID_Start and ID_Continue -assert.throws(SyntaxError, () => eval("/(?<\\>.)/u"), "'\' misclassified as ID_Start"); -assert.throws(SyntaxError, () => eval("/(?<a\\>.)/u"), "'\' misclassified as ID_Continue"); diff --git a/test/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4-u.js b/test/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4-u.js new file mode 100644 index 0000000000..45b1ca6333 --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-non-id-continue-groupspecifier-4-u.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +throw "Test262: This statement should not be evaluated."; + +/(?<a\>.)/u; diff --git a/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2-u.js b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2-u.js new file mode 100644 index 0000000000..fdc8775572 --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-2-u.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +throw "Test262: This statement should not be evaluated."; + +/(?<𐒤>a)/u; diff --git a/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4-u.js b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4-u.js new file mode 100644 index 0000000000..af260334db --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-4-u.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +throw "Test262: This statement should not be evaluated."; + +/(?<a\uD801>.)/u; diff --git a/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5-u.js b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5-u.js new file mode 100644 index 0000000000..fb3d9c414b --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-5-u.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +throw "Test262: This statement should not be evaluated."; + +/(?<a\uDCA4>.)/u; diff --git a/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8-u.js b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8-u.js new file mode 100644 index 0000000000..7796572c74 --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-8-u.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +throw "Test262: This statement should not be evaluated."; + +/(?<\>.)/u; diff --git a/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-9-u.js b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-9-u.js new file mode 100644 index 0000000000..7fff1ae790 --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-9-u.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +throw "Test262: This statement should not be evaluated."; + +/(?<a\u{110000}>.)/u; diff --git a/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-u.js b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-u.js new file mode 100644 index 0000000000..ea4a41b5f8 --- /dev/null +++ b/test/language/literals/regexp/named-groups/invalid-non-id-start-groupspecifier-u.js @@ -0,0 +1,15 @@ +// Copyright 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: GroupSpecifier must be identifier-like. +esid: prod-GroupSpecifier +negative: + phase: parse + type: SyntaxError +features: [regexp-named-groups] +---*/ + +throw "Test262: This statement should not be evaluated."; + +/(?<❤>a)/u; -- GitLab