diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /js/src/tests/test262/language/literals/regexp/u-astral.js | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/language/literals/regexp/u-astral.js')
-rw-r--r-- | js/src/tests/test262/language/literals/regexp/u-astral.js | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/literals/regexp/u-astral.js b/js/src/tests/test262/language/literals/regexp/u-astral.js new file mode 100644 index 0000000000..70ab2b3cc6 --- /dev/null +++ b/js/src/tests/test262/language/literals/regexp/u-astral.js @@ -0,0 +1,57 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Literal astral symbols within a pattern +es6id: 21.2.2.8.2 +info: | + 21.2.2.2 Pattern + + The production Pattern :: Disjunction evaluates as follows: + + 1. Evaluate Disjunction to obtain a Matcher m. + 2. Return an internal closure that takes two arguments, a String str + and an integer index, and performs the following steps: + 1. If Unicode is true, let Input be a List consisting of the + sequence of code points of str interpreted as a UTF-16 encoded + (6.1.4) Unicode string. Otherwise, let Input be a List consisting + of the sequence of code units that are the elements of str. Input + will be used throughout the algorithms in 21.2.2. Each element of + Input is considered to be a character. +---*/ + +assert(/𝌆{2}/u.test('𝌆𝌆'), 'quantifier application'); + +assert(/^[𝌆]$/u.test('𝌆'), 'as a ClassAtom'); + +var rangeRe = /[💩-💫]/u; +assert.sameValue( + rangeRe.test('\ud83d\udca8'), + false, + 'ClassAtom as lower range boundary, input below (U+1F4A8)' +); +assert.sameValue( + rangeRe.test('\ud83d\udca9'), + true, + 'ClassAtom as lower range boundary, input match (U+1F4A9)' +); +assert.sameValue( + rangeRe.test('\ud83d\udcaa'), + true, + 'ClassAtom as upper- and lower-range boundary, input within (U+1F4AA)' +); +assert.sameValue( + rangeRe.test('\ud83d\udcab'), + true, + 'ClassAtom as upper range boundary, input match (U+1F4AB)' +); +assert.sameValue( + rangeRe.test('\ud83d\udcac'), + false, + 'ClassAtom as upper range boundary, input above (U+1F4AC)' +); + +assert(/[^𝌆]/u.test('\ud834'), 'Negated character classes (LeadSurrogate)'); +assert(/[^𝌆]/u.test('\udf06'), 'Negated character classes (TrailSurrogate)'); + +reportCompare(0, 0); |