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

Unified Diff: test/mjsunit/harmony/regexp-property-char-class.js

Issue 1774623005: [regexp] support \p in character classes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/regexp/regexp-parser.cc ('k') | test/mjsunit/harmony/regexp-property-disabled.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/regexp-property-char-class.js
diff --git a/test/mjsunit/harmony/regexp-property-char-class.js b/test/mjsunit/harmony/regexp-property-char-class.js
new file mode 100644
index 0000000000000000000000000000000000000000..76774cb572e0d88cc4ac127049183712af55a365
--- /dev/null
+++ b/test/mjsunit/harmony/regexp-property-char-class.js
@@ -0,0 +1,27 @@
+// Copyright 2011 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-unicode-regexps --harmony-regexp-property
+
+assertThrows("/[\\p]/u");
+assertThrows("/[\\p{garbage}]/u");
+assertThrows("/[\\p{}]/u");
+assertThrows("/[\\p{]/u");
+assertThrows("/[\\p}]/u");
+assertThrows("/[\\p{Math}]/u");
+assertThrows("/[\\p{Bidi_M}]/u");
+assertThrows("/[\\p{Hex}]/u");
+
+assertTrue(/^[\p{Lu}\p{Ll}]+$/u.test("ABCabc"));
+assertTrue(/^[\p{Lu}-\p{Ll}]+$/u.test("ABC-abc"));
+assertFalse(/^[\P{Lu}\p{Ll}]+$/u.test("ABCabc"));
+assertTrue(/^[\P{Lu}\p{Ll}]+$/u.test("abc"));
+assertTrue(/^[\P{Lu}]+$/u.test("abc123"));
+assertFalse(/^[\P{Lu}]+$/u.test("XYZ"));
+
+assertTrue(/^[^\P{Lu}]+$/u.test("XYZ"));
+assertFalse(/^[^\p{Lu}\p{Ll}]+$/u.test("abc"));
+assertFalse(/^[^\p{Lu}\p{Ll}]+$/u.test("ABC"));
+assertTrue(/^[^\p{Lu}\p{Ll}]+$/u.test("123"));
+assertTrue(/^[^\p{Lu}\P{Ll}]+$/u.test("abc"));
« no previous file with comments | « src/regexp/regexp-parser.cc ('k') | test/mjsunit/harmony/regexp-property-disabled.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698