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

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

Issue 1780183002: [regexp] extend property classes by unicode blocks. (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-script-category.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/regexp-property-blocks.js
diff --git a/test/mjsunit/harmony/regexp-property-blocks.js b/test/mjsunit/harmony/regexp-property-blocks.js
new file mode 100644
index 0000000000000000000000000000000000000000..cea86fdccc402baf4ef08bacb18c0981d9042c63
--- /dev/null
+++ b/test/mjsunit/harmony/regexp-property-blocks.js
@@ -0,0 +1,39 @@
+// Copyright 2016 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-regexp-property --harmony-unicode-regexps
+
+function t(re, s) { assertTrue(re.test(s)); }
+function f(re, s) { assertFalse(re.test(s)); }
+
+t(/\p{InASCII}+/u, ".");
+t(/\p{In ASCII}+/u, "supercalifragilisticexpialidocious");
+t(/\p{In Basic Latin}+/u, ".");
+t(/\p{InBasicLatin}+/u, "supercalifragilisticexpialidocious");
+t(/\p{InBasic_Latin}+/u, ".");
+t(/\p{InBasic_Latin}+/u, "supercalifragilisticexpialidocious");
+t(/\p{InBasicLatin}+/u, ".");
+t(/\p{InBasicLatin}+/u, "supercalifragilisticexpialidocious");
+
+t(/\p{In CJK}+/u, "话说天下大势,分久必合,合久必分");
+t(/\p{InCJK}+/u, "吾庄后有一桃园,花开正盛");
+f(/\p{InCJKUnifiedIdeographs}+/u, "おはようございます");
+f(/\p{In CJK unified ideographs}+/u,
+ "Something is rotten in the state of Denmark");
+
+t(/\p{InLatin_1}+/u, "Wie froh bin ich, daß ich weg bin!");
+f(/\p{InASCII}+/u, "奔腾千里荡尘埃,渡水登山紫雾开");
+f(/\p{In Latin 1}+/u, "いただきます");
+
+t(/\p{InHiragana}/u, "いただきます");
+t(/\p{Hiragana}/u, "\u{1b001}"); // This refers to the script "Hiragana".
+f(/\p{InHiragana}/u, "\u{1b001}"); // This refers to the block "Hiragana".
+
+t(/\p{InGreekAndCoptic}/u, "ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ");
+t(/\p{InGreek}/u, "μῆνιν ἄειδε θεὰ Πηληϊάδεω Ἀχιλῆος");
+
+assertThrows("/\\p{In}/u");
+assertThrows("/\\pI/u");
+assertThrows("/\\p{I}/u");
+assertThrows("/\\p{CJK}/u");
« no previous file with comments | « src/regexp/regexp-parser.cc ('k') | test/mjsunit/harmony/regexp-property-script-category.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698