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-regexp-property --harmony-unicode-regexps | |
6 | |
7 function t(re, s) { assertTrue(re.test(s)); } | |
8 function f(re, s) { assertFalse(re.test(s)); } | |
9 | |
10 t(/\p{ASCII}+/u, "abc123"); | |
11 f(/\p{ASCII}+/u, "ⓐⓑⓒ①②③"); | |
12 f(/\p{ASCII}+/u, "🄰🄱🄲①②③"); | |
13 f(/\P{ASCII}+/u, "abcd123"); | |
14 t(/\P{ASCII}+/u, "ⓐⓑⓒ①②③"); | |
15 t(/\P{ASCII}+/u, "🄰🄱🄲①②③"); | |
16 | |
17 f(/[^\p{ASCII}]+/u, "abc123"); | |
18 f(/[\p{ASCII}]+/u, "ⓐⓑⓒ①②③"); | |
19 f(/[\p{ASCII}]+/u, "🄰🄱🄲①②③"); | |
20 t(/[^\P{ASCII}]+/u, "abcd123"); | |
21 t(/[\P{ASCII}]+/u, "ⓐⓑⓒ①②③"); | |
22 f(/[^\P{ASCII}]+/u, "🄰🄱🄲①②③"); | |
23 | |
24 t(/\p{Any}+/u, "🄰🄱🄲①②③"); | |
25 | |
26 assertEquals(["\ud800"], /\p{Any}/u.exec("\ud800\ud801")); | |
27 assertEquals(["\udc00"], /\p{Any}/u.exec("\udc00\udc01")); | |
28 assertEquals(["\ud800\udc01"], /\p{Any}/u.exec("\ud800\udc01")); | |
29 assertEquals(["\udc01"], /\p{Any}/u.exec("\udc01")); | |
30 | |
31 f(/\P{Any}+/u, "123"); | |
32 f(/[\P{Any}]+/u, "123"); | |
33 t(/[\P{Any}\d]+/u, "123"); | |
34 t(/[^\P{Any}]+/u, "123"); | |
35 | |
36 t(/\p{Assigned}+/u, "123"); | |
37 t(/\p{Assigned}+/u, "🄰🄱🄲"); | |
38 f(/\p{Assigned}+/u, "\ufdd0"); | |
39 f(/\p{Assigned}+/u, "\u{fffff}"); | |
40 | |
41 f(/\P{Assigned}+/u, "123"); | |
42 f(/\P{Assigned}+/u, "🄰🄱🄲"); | |
43 t(/\P{Assigned}+/u, "\ufdd0"); | |
44 t(/\P{Assigned}+/u, "\u{fffff}"); | |
45 f(/\P{Assigned}/u, ""); | |
46 | |
47 t(/[^\P{Assigned}]+/u, "123"); | |
48 f(/[\P{Assigned}]+/u, "🄰🄱🄲"); | |
49 f(/[^\P{Assigned}]+/u, "\ufdd0"); | |
50 t(/[\P{Assigned}]+/u, "\u{fffff}"); | |
51 f(/[\P{Assigned}]/u, ""); | |
OLD | NEW |