OLD | NEW |
| (Empty) |
1 // Copyright 2016 the V8 project authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Flags: --harmony-unicode-regexps | |
6 | |
7 // Non-unicode use toUpperCase mappings. | |
8 assertFalse(/[\u00e5]/i.test("\u212b")); | |
9 assertFalse(/[\u212b]/i.test("\u00e5\u1234")); | |
10 assertFalse(/[\u212b]/i.test("\u00e5")); | |
11 | |
12 assertTrue("\u212b".toLowerCase() == "\u00e5"); | |
13 assertTrue("\u00c5".toLowerCase() == "\u00e5"); | |
14 assertTrue("\u00e5".toUpperCase() == "\u00c5"); | |
15 | |
16 // Unicode uses case folding mappings. | |
17 assertFalse(/\u00e5/ui.test("\u212b")); | |
18 assertTrue(/\u00e5/ui.test("\u00c5")); | |
19 assertTrue(/\u00e5/ui.test("\u00e5")); | |
20 assertFalse(/\u00e5/ui.test("\u212b")); | |
21 assertTrue(/\u00c5/ui.test("\u00e5")); | |
22 assertFalse(/\u00c5/ui.test("\u212b")); | |
23 assertTrue(/\u00c5/ui.test("\u00c5")); | |
24 assertFalse(/\u212b/ui.test("\u00c5")); | |
25 assertFalse(/\u212b/ui.test("\u00e5")); | |
26 assertTrue(/\u212b/ui.test("\u212b")); | |
27 | |
28 // Non-BMP. | |
29 assertFalse(/\u{10400}/i.test("\u{10428}")); | |
30 assertFalse(/\u{10400}/ui.test("\u{10428}")); | |
31 assertFalse(/\ud801\udc00/ui.test("\u{10428}")); | |
32 assertFalse(/[\u{10428}]/ui.test("\u{10400}")); | |
33 assertFalse(/[\ud801\udc28]/ui.test("\u{10400}")); | |
34 assertEquals(["\uff21\u{10400}"], | |
35 /[\uff40-\u{10428}]+/ui.exec("\uff21\u{10400}abc")); | |
36 assertEquals(["abc"], /[^\uff40-\u{10428}]+/ui.exec("\uff21\u{10400}abc\uff23"))
; | |
37 assertEquals(["\uff53\u24bb"], | |
38 /[\u24d5-\uff33]+/ui.exec("\uff54\uff53\u24bb\u24ba")); | |
39 | |
40 // Full mappings are ignored. | |
41 assertFalse(/\u00df/ui.test("SS")); | |
42 assertFalse(/\u1f8d/ui.test("\u1f05\u03b9")); | |
43 | |
44 // Simple mappings. | |
45 assertFalse(/\u1f8d/ui.test("\u1f85")); | |
46 | |
47 // Common mappings. | |
48 assertTrue(/\u1f6b/ui.test("\u1f63")); | |
49 | |
50 // Back references. | |
51 assertNull(/(.)\1\1/ui.exec("\u00e5\u212b\u00c5")); | |
52 assertNull(/(.)\1/ui.exec("\u{118aa}\u{118ca}")); | |
53 | |
54 | |
55 // Non-Latin1 maps to Latin1. | |
56 assertNull(/^\u017F/ui.exec("s")); | |
57 assertNull(/^\u017F/ui.exec("s\u1234")); | |
58 assertNull(/^a[\u017F]/ui.exec("as")); | |
59 assertNull(/^a[\u017F]/ui.exec("as\u1234")); | |
OLD | NEW |