Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/literals/regexp/u-surrogate-pairs-atom-char-class.js

raw
1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-atom
5 es6id: 21.2.2.8
6 description: >
7 Support for surrogate pairs within patterns match by the CharacterClass Atom
8 info: |
9 The production Atom :: CharacterClass evaluates as follows:
10
11 1. Evaluate CharacterClass to obtain a CharSet A and a Boolean invert.
12 2. Call CharacterSetMatcher(A, invert) and return its Matcher result.
13
14 Runtime Semantics: CharacterSetMatcher Abstract Operation
15
16 1. Return an internal Matcher closure that takes two arguments, a State x and
17 a Continuation c, and performs the following steps when evaluated:
18 [...]
19 d. Let cc be Canonicalize(ch).
20 [...]
21 ---*/
22
23 assert(/^[\ud800\udc00]$/u.test('\ud800\udc00'));
24 assert.sameValue(
25 /[\ud800\udc00]/u.test('\ud800'),
26 false,
27 '\\ud800 does not qualify as a class member'
28 );
29 assert.sameValue(
30 /[\ud800\udc00]/u.test('\udc00'),
31 false,
32 '\\udc00 does not qualify as a class member'
33 );