Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Side by Side Diff: test/mjsunit/harmony/regexp-property-special.js

Issue 2059113002: [regexp] implement \p{Any}, \p{Ascii}, and \p{Assigned}. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« src/regexp/regexp-parser.cc ('K') | « src/regexp/regexp-parser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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, "🄰🄱🄲");
mathias 2016/06/13 20:43:58 Maybe test the empty string as well? f(/\P{As
Yang 2016/06/14 09:44:11 Done.
43 t(/\P{Assigned}+/u, "\ufdd0");
44 t(/\P{Assigned}+/u, "\u{fffff}");
45
46 t(/[^\P{Assigned}]+/u, "123");
47 f(/[\P{Assigned}]+/u, "🄰🄱🄲");
48 f(/[^\P{Assigned}]+/u, "\ufdd0");
49 t(/[\P{Assigned}]+/u, "\u{fffff}");
OLDNEW
« src/regexp/regexp-parser.cc ('K') | « src/regexp/regexp-parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698