OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --harmony-regexp-property | 5 // Flags: --harmony-regexp-property |
6 | 6 |
7 function t(re, s) { assertTrue(re.test(s)); } | 7 function t(re, s) { assertTrue(re.test(s)); } |
8 function f(re, s) { assertFalse(re.test(s)); } | 8 function f(re, s) { assertFalse(re.test(s)); } |
9 | 9 |
10 t(/\p{ASCII}+/u, "abc123"); | 10 t(/\p{ASCII}+/u, "abc123"); |
(...skipping 26 matching lines...) Expand all Loading... |
37 t(/\p{Assigned}+/u, "🄰🄱🄲"); | 37 t(/\p{Assigned}+/u, "🄰🄱🄲"); |
38 f(/\p{Assigned}+/u, "\ufdd0"); | 38 f(/\p{Assigned}+/u, "\ufdd0"); |
39 f(/\p{Assigned}+/u, "\u{fffff}"); | 39 f(/\p{Assigned}+/u, "\u{fffff}"); |
40 | 40 |
41 f(/\P{Assigned}+/u, "123"); | 41 f(/\P{Assigned}+/u, "123"); |
42 f(/\P{Assigned}+/u, "🄰🄱🄲"); | 42 f(/\P{Assigned}+/u, "🄰🄱🄲"); |
43 t(/\P{Assigned}+/u, "\ufdd0"); | 43 t(/\P{Assigned}+/u, "\ufdd0"); |
44 t(/\P{Assigned}+/u, "\u{fffff}"); | 44 t(/\P{Assigned}+/u, "\u{fffff}"); |
45 f(/\P{Assigned}/u, ""); | 45 f(/\P{Assigned}/u, ""); |
46 | 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, ""); |
| 52 |
47 f(/[^\u1234\p{ASCII}]+/u, "\u1234"); | 53 f(/[^\u1234\p{ASCII}]+/u, "\u1234"); |
48 t(/[x\P{ASCII}]+/u, "x"); | 54 t(/[x\P{ASCII}]+/u, "x"); |
49 t(/[\u1234\p{ASCII}]+/u, "\u1234"); | 55 t(/[\u1234\p{ASCII}]+/u, "\u1234"); |
50 | 56 |
51 t(/^\p{Other_ID_Start}+$/u, "\u1885\u1886\u2118\u212e\u309b\u309c"); | 57 // Contributory binary properties are not supported. |
52 f(/\P{OIDS}/u, "\u1885\u1886\u2118\u212e\u309b\u309c"); | 58 assertThrows("/\\p{Other_Alphabetic}/u"); |
53 f(/^[x\P{Other_ID_Start}]+$/u, "\u1885\u1886\u2118\u212e\u309b\u309cx"); | 59 assertThrows("/\\P{OAlpha}/u"); |
54 f(/[x\P{OIDS}]/u, "\u1885\u1886\u2118\u212e\u309b\u309c"); | 60 assertThrows("/\\p{Other_Default_Ignorable_Code_Point}/u"); |
55 | 61 assertThrows("/\\P{ODI}/u"); |
56 var other_id_continue = "\u00b7\u0387\u1369\u136a\u136b\u136c" + | 62 assertThrows("/\\p{Other_Grapheme_Extend}/u"); |
57 "\u136d\u136e\u136f\u1370\u1371\u19da"; | 63 assertThrows("/\\P{OGr_Ext}/u"); |
58 t(/^\p{Other_ID_Continue}+$/u, other_id_continue); | 64 assertThrows("/\\p{Other_ID_Continue}/u"); |
59 f(/\P{OIDC}/u, other_id_continue); | 65 assertThrows("/\\P{OIDC}/u"); |
| 66 assertThrows("/\\p{Other_ID_Start}/u"); |
| 67 assertThrows("/\\P{OIDS}/u"); |
| 68 assertThrows("/\\p{Other_Lowercase}/u"); |
| 69 assertThrows("/\\P{OLower}/u"); |
| 70 assertThrows("/\\p{Other_Math}/u"); |
| 71 assertThrows("/\\P{OMath}/u"); |
| 72 assertThrows("/\\p{Other_Uppercase}/u"); |
| 73 assertThrows("/\\P{OUpper}/u"); |
OLD | NEW |