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

Unified Diff: test/mjsunit/regexp.js

Issue 2793313002: [regexp] Add tests for recent changes in Annex B (Closed)
Patch Set: Rebase and address comments 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 | « src/regexp/regexp-parser.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regexp.js
diff --git a/test/mjsunit/regexp.js b/test/mjsunit/regexp.js
index c9a1fd21b328449ab1d320d5041fed86eb4c0f75..6fb5660c0806d597411785ddd2dd15efdbc31aa4 100644
--- a/test/mjsunit/regexp.js
+++ b/test/mjsunit/regexp.js
@@ -764,3 +764,42 @@ re.lastIndex = NaN;
assertEquals(NaN, re.lastIndex);
"abc".search(re);
assertEquals(NaN, re.lastIndex);
+
+// Annex B changes: https://github.com/tc39/ecma262/pull/303
+
+assertThrows("/{1}/", SyntaxError);
+assertTrue(/^{*$/.test("{{{"));
+assertTrue(/^}*$/.test("}}}"));
+assertTrue(/]/.test("]"));
+assertTrue(/^\c%$/.test("\\c%")); // We go into ExtendedPatternCharacter.
+assertTrue(/^\d%$/.test("2%")); // ... CharacterClassEscape.
+assertTrue(/^\e%$/.test("e%")); // ... IdentityEscape.
+assertTrue(/^\ca$/.test("\u{1}")); // ... ControlLetter.
+assertTrue(/^\cA$/.test("\u{1}")); // ... ControlLetter.
+assertTrue(/^\c9$/.test("\\c9")); // ... ExtendedPatternCharacter.
+assertTrue(/^\c$/.test("\\c")); // ... ExtendedPatternCharacter.
+assertTrue(/^[\c%]*$/.test("\\c%")); // TODO(v8:6201): Not covered by the spec.
+assertTrue(/^[\c:]*$/.test("\\c:")); // TODO(v8:6201): Not covered by the spec.
+assertTrue(/^[\c0]*$/.test("\u{10}")); // ... ClassControlLetter.
+assertTrue(/^[\c1]*$/.test("\u{11}")); // ('0' % 32 == 0x10)
+assertTrue(/^[\c2]*$/.test("\u{12}"));
+assertTrue(/^[\c3]*$/.test("\u{13}"));
+assertTrue(/^[\c4]*$/.test("\u{14}"));
+assertTrue(/^[\c5]*$/.test("\u{15}"));
+assertTrue(/^[\c6]*$/.test("\u{16}"));
+assertTrue(/^[\c7]*$/.test("\u{17}"));
+assertTrue(/^[\c8]*$/.test("\u{18}"));
+assertTrue(/^[\c9]*$/.test("\u{19}"));
+assertTrue(/^[\c_]*$/.test("\u{1F}"));
+assertTrue(/^[\c11]*$/.test("\u{11}1"));
+assertTrue(/^[\8]*$/.test("8")); // ... ClassEscape ~~> IdentityEscape.
+assertTrue(/^[\7]*$/.test("\u{7}")); // ... ClassEscape
+ // ~~> LegacyOctalEscapeSequence.
+assertTrue(/^[\11]*$/.test("\u{9}"));
+assertTrue(/^[\111]*$/.test("\u{49}"));
+assertTrue(/^[\222]*$/.test("\u{92}"));
+assertTrue(/^[\333]*$/.test("\u{DB}"));
+assertTrue(/^[\444]*$/.test("\u{24}4"));
+assertTrue(/^[\d-X]*$/.test("234-X-432")); // CharacterRangeOrUnion.
+assertTrue(/^[\d-X-Z]*$/.test("234-XZ-432"));
+assertFalse(/^[\d-X-Z]*$/.test("234-XYZ-432"));
« no previous file with comments | « src/regexp/regexp-parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698