| 1 |
// Copyright (C) 2015 the V8 project authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
description: Case mapping of astral symbols |
| 6 |
es6id: 21.2.2.8.2 |
| 7 |
info: | |
| 8 |
21.2.2.8.2 Runtime Semantics: Canonicalize ( ch ) |
| 9 |
|
| 10 |
The abstract operation Canonicalize takes a character parameter ch and |
| 11 |
performs the following steps: |
| 12 |
|
| 13 |
1. If IgnoreCase is false, return ch. |
| 14 |
2. If Unicode is true, |
| 15 |
a. If the file CaseFolding.txt of the Unicode Character Database |
| 16 |
provides a simple or common case folding mapping for ch, return |
| 17 |
the result of applying that mapping to ch. |
| 18 |
b. Else, return ch. |
| 19 |
---*/ |
| 20 |
|
| 21 |
assert.sameValue( |
| 22 |
/\u212a/i.test('k'), |
| 23 |
false, |
| 24 |
'Case mapping is not applied in the absence of the `u` flag' |
| 25 |
); |
| 26 |
assert.sameValue( |
| 27 |
/\u212a/i.test('K'), |
| 28 |
false, |
| 29 |
'Case mapping is not applied in the absence of the `u` flag' |
| 30 |
); |
| 31 |
assert.sameValue( |
| 32 |
/\u212a/u.test('k'), |
| 33 |
false, |
| 34 |
'Case mapping is not applied in the absence of the `i` flag' |
| 35 |
); |
| 36 |
assert.sameValue( |
| 37 |
/\u212a/u.test('K'), |
| 38 |
false, |
| 39 |
'Case mapping is not applied in the absence of the `i` flag' |
| 40 |
); |
| 41 |
|
| 42 |
assert( |
| 43 |
/\u212a/iu.test('k'), |
| 44 |
'Case mapping is applied in the presence of the `i` and `u` flags' |
| 45 |
); |
| 46 |
assert( |
| 47 |
/\u212a/iu.test('K'), |
| 48 |
'Case mapping is applied in the presence of the `i` and `u` flags' |
| 49 |
); |