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

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

Issue 2807293003: [regexp] Add tests for binary property classes. (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/regexp-property-binary.js
diff --git a/test/mjsunit/harmony/regexp-property-binary.js b/test/mjsunit/harmony/regexp-property-binary.js
index f1c58f9ea6e93570a892ff40e85e42f2f1fa7400..e1daf08568b4cad64094ecc703a387bf08e1f0f2 100644
--- a/test/mjsunit/harmony/regexp-property-binary.js
+++ b/test/mjsunit/harmony/regexp-property-binary.js
@@ -7,35 +7,155 @@
function t(re, s) { assertTrue(re.test(s)); }
function f(re, s) { assertFalse(re.test(s)); }
-t(/\p{Bidi_Control}+/u, "\u200E");
-f(/\p{Bidi_C}+/u, "On a dark desert highway, cool wind in my hair");
-t(/\p{AHex}+/u, "DEADBEEF");
-t(/\p{Alphabetic}+/u, "abcdefg");
-t(/\P{Alphabetic}+/u, "1234");
-t(/\p{White_Space}+/u, "\u00A0");
-t(/\p{Uppercase}+/u, "V");
-f(/\p{Lower}+/u, "U");
-t(/\p{Ideo}+/u, "字");
-f(/\p{Ideo}+/u, "x");
-t(/\p{Noncharacter_Code_Point}+/u, "\uFDD0");
-t(/\p{Default_Ignorable_Code_Point}+/u, "\u00AD");
-t(/\p{ASCII}+/u, "a");
-f(/\p{ASCII}+/u, "äöü");
-t(/\p{ID_Start}+/u, "a");
-f(/\p{ID_Start}+/u, "1\\");
-t(/\p{ID_Continue}+/u, "1");
-f(/\p{ID_Continue}+/u, "%\\");
-t(/\p{Join_Control}+/u, "\u200c");
-f(/\p{Join_Control}+/u, "a1");
-t(/\p{Emoji_Presentation}+/u, "\u{1F308}");
-f(/\p{Emoji_Presentation}+/u, "x");
-t(/\p{Emoji_Modifier}+/u, "\u{1F3FE}");
-f(/\p{Emoji_Modifier}+/u, "x");
-t(/\p{Emoji_Modifier_Base}+/u, "\u{1F6CC}");
-f(/\p{Emoji_Modifier_Base}+/u, "x");
-
assertThrows("/\\p{Hiragana}/u");
assertThrows("/\\p{Bidi_Class}/u");
assertThrows("/\\p{Bidi_C=False}/u");
assertThrows("/\\P{Bidi_Control=Y}/u");
assertThrows("/\\p{AHex=Yes}/u");
+
+t(/\p{Alphabetic}/u, "æ");
+f(/\p{Alpha}/u, "1");
+
+t(/\p{ASCII_Hex_Digit}/u, "f");
+f(/\p{AHex}/u, "g");
+
+t(/\p{Bidi_Control}/u, "\u200e");
+f(/\p{Bidi_C}/u, "g");
+
+t(/\p{Bidi_Mirrored}/u, "(");
+f(/\p{Bidi_M}/u, "-");
+
+t(/\p{Case_Ignorable}/u, "\u02b0");
+f(/\p{CI}/u, "a");
+
+t(/\p{Changes_When_Casefolded}/u, "B");
+f(/\p{CWCF}/u, "1");
+
+t(/\p{Changes_When_Casemapped}/u, "b");
+f(/\p{CWCM}/u, "1");
+
+t(/\p{Changes_When_Lowercased}/u, "B");
+f(/\p{CWL}/u, "1");
+
+t(/\p{Changes_When_Titlecased}/u, "b");
+f(/\p{CWT}/u, "1");
+
+t(/\p{Changes_When_Uppercased}/u, "b");
+f(/\p{CWU}/u, "1");
+
+//t(/\p{Composition_Exclusion}/u, "\u0958");
+//f(/\p{CE}/u, "1");
mathias 2017/04/11 13:07:44 From http://unicode.org/reports/tr44/#Decompositio
+
+t(/\p{Dash}/u, "-");
+f(/\p{Dash}/u, "1");
+
+t(/\p{Default_Ignorable_Code_Point}/u, "\u00ad");
+f(/\p{DI}/u, "1");
+
+t(/\p{Deprecated}/u, "\u17a3");
+f(/\p{Dep}/u, "1");
+
+t(/\p{Diacritic}/u, "\u0301");
+f(/\p{Dia}/u, "1");
+
+t(/\p{Emoji}/u, "\u2603");
+f(/\p{Emoji}/u, "x");
+
+// t(/\p{Emoji_Component}/u, "\u2603");
+// f(/\p{Emoji_Component}/u, "x");
mathias 2017/04/11 13:07:44 It makes sense for ICU not to support `Emoji_Compo
+
+t(/\p{Emoji_Modifier_Base}/u, "\u{1F6CC}");
+f(/\p{Emoji_Modifier_Base}/u, "x");
+
+t(/\p{Emoji_Modifier}/u, "\u{1F3FE}");
+f(/\p{Emoji_Modifier}/u, "x");
+
+t(/\p{Emoji_Presentation}/u, "\u{1F308}");
+f(/\p{Emoji_Presentation}/u, "x");
+
+t(/\p{Extender}/u, "\u3005");
+f(/\p{Ext}/u, "x");
+
+t(/\p{Full_Composition_Exclusion}/u, "\uFB1F");
+f(/\p{Comp_Ex}/u, "x");
+
+t(/\p{Grapheme_Base}/u, " ");
+f(/\p{Gr_Base}/u, "\u0010");
+
+t(/\p{Grapheme_Extend}/u, "\u0300");
+f(/\p{Gr_Ext}/u, "x");
+
+t(/\p{Hex_Digit}/u, "a");
+f(/\p{Hex}/u, "g");
+
+t(/\p{ID_Continue}/u, "1");
+f(/\p{IDC}/u, ".");
+
+t(/\p{ID_Start}/u, "a");
+f(/\p{IDS}/u, "1");
+
+t(/\p{Ideographic}/u, "漢");
+f(/\p{Ideo}/u, "H");
+
+t(/\p{IDS_Binary_Operator}/u, "\u2FF0");
+f(/\p{IDSB}/u, "a");
+
+t(/\p{IDS_Trinary_Operator}/u, "\u2FF2");
+f(/\p{IDST}/u, "a");
+
+t(/\p{Join_Control}/u, "\u200c");
+f(/\p{Join_C}/u, "a");
+
+t(/\p{Logical_Order_Exception}/u, "\u0e40");
+f(/\p{LOE}/u, "a");
+
+t(/\p{Lowercase}/u, "a");
+f(/\p{Lower}/u, "A");
+
+t(/\p{Math}/u, "=");
+f(/\p{Math}/u, "A");
+
+t(/\p{Noncharacter_Code_Point}/u, "\uFDD0");
+f(/\p{NChar}/u, "A");
+
+t(/\p{Pattern_Syntax}/u, "\u0021");
+f(/\p{NChar}/u, "A");
+
+t(/\p{Pattern_White_Space}/u, "\u0009");
+f(/\p{Pat_Syn}/u, "A");
+
+// t(/\p{Prepended_Concatenation_Mark}/u, "\uFDD0");
+// f(/\p{PCM}/u, "A");
mathias 2017/04/11 13:07:44 I can’t think of a reason for ICU not to support t
+
+t(/\p{Quotation_Mark}/u, "'");
+f(/\p{QMark}/u, "A");
+
+t(/\p{Radical}/u, "\u2FAD");
+f(/\p{Radical}/u, "A");
+
+t(/\p{Sentence_Terminal}/u, "!");
+f(/\p{STerm}/u, "A");
+
+t(/\p{Soft_Dotted}/u, "i");
+f(/\p{SD}/u, "A");
+
+t(/\p{Terminal_Punctuation}/u, ".");
+f(/\p{Term}/u, "A");
+
+t(/\p{Unified_Ideograph}/u, "\u4e00");
+f(/\p{UIdeo}/u, "A");
+
+t(/\p{Uppercase}/u, "A");
+f(/\p{Upper}/u, "a");
+
+t(/\p{Variation_Selector}/u, "\uFE00");
+f(/\p{VS}/u, "A");
+
+t(/\p{White_Space}/u, " ");
+f(/\p{WSpace}/u, "A");
+
+t(/\p{XID_Continue}/u, "1");
+f(/\p{XIDC}/u, " ");
+
+t(/\p{XID_Start}/u, "A");
+f(/\p{XIDS}/u, " ");
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698