summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/regexp_parse/CharacterClass_RegExpUnicodeEscapeSequence.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/jit-test/tests/regexp_parse/CharacterClass_RegExpUnicodeEscapeSequence.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/jit-test/tests/regexp_parse/CharacterClass_RegExpUnicodeEscapeSequence.js')
-rw-r--r--js/src/jit-test/tests/regexp_parse/CharacterClass_RegExpUnicodeEscapeSequence.js162
1 files changed, 162 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/regexp_parse/CharacterClass_RegExpUnicodeEscapeSequence.js b/js/src/jit-test/tests/regexp_parse/CharacterClass_RegExpUnicodeEscapeSequence.js
new file mode 100644
index 000000000..ee111973d
--- /dev/null
+++ b/js/src/jit-test/tests/regexp_parse/CharacterClass_RegExpUnicodeEscapeSequence.js
@@ -0,0 +1,162 @@
+if (typeof parseRegExp === 'undefined')
+ quit();
+
+load(libdir + "regexp_parse.js");
+
+// LeadSurrogate TrailSurrogate
+
+test("[X\\uD83D\\uDC38Y]", no_unicode_flags,
+ CharacterClass([
+ ["X", "X"],
+ ["\uD83D", "\uD83D"],
+ ["\uDC38", "\uDC38"],
+ ["Y", "Y"]
+ ]));
+test("[X\\uD83D\\uDC38Y]", unicode_flags,
+ Disjunction([
+ CharacterClass([
+ ["X", "X"],
+ ["Y", "Y"],
+ ]),
+ Atom("\uD83D\uDC38")
+ ]));
+
+// LeadSurrogate
+
+test("[X\\uD83DY]", no_unicode_flags,
+ CharacterClass([
+ ["X", "X"],
+ ["\uD83D", "\uD83D"],
+ ["Y", "Y"]
+ ]));
+test("[X\\uD83DY]", unicode_flags,
+ Disjunction([
+ CharacterClass([
+ ["X", "X"],
+ ["Y", "Y"]
+ ]),
+ Alternative([
+ CharacterClass([
+ ["\uD83D", "\uD83D"]
+ ]),
+ NegativeLookahead(CharacterClass([["\uDC00", "\uDFFF"]]))
+ ])
+ ]));
+
+// TrailSurrogate
+
+test("[X\\uDC38Y]", no_unicode_flags,
+ CharacterClass([
+ ["X", "X"],
+ ["\uDC38", "\uDC38"],
+ ["Y", "Y"]
+ ]));
+test("[X\\uDC38Y]", unicode_flags,
+ Disjunction([
+ CharacterClass([
+ ["X", "X"],
+ ["Y", "Y"]
+ ]),
+ Alternative([
+ Assertion("NOT_AFTER_LEAD_SURROGATE"),
+ CharacterClass([
+ ["\uDC38", "\uDC38"]
+ ])
+ ])
+ ]));
+
+// NonSurrogate / Hex4Digits
+
+test("[X\\u0000Y]", all_flags,
+ CharacterClass([
+ ["X", "X"],
+ ["\u0000", "\u0000"],
+ ["Y", "Y"]
+ ]));
+test("[X\\uFFFFY]", all_flags,
+ CharacterClass([
+ ["X", "X"],
+ ["\uFFFF", "\uFFFF"],
+ ["Y", "Y"]
+ ]));
+
+// braced HexDigits
+
+test("[X\\u{0000}Y]", unicode_flags,
+ CharacterClass([
+ ["X", "X"],
+ ["\u0000", "\u0000"],
+ ["Y", "Y"]
+ ]));
+test("[X\\uFFFFY]", unicode_flags,
+ CharacterClass([
+ ["X", "X"],
+ ["\uFFFF", "\uFFFF"],
+ ["Y", "Y"]
+ ]));
+
+test("[X\\u{1F438}Y]", unicode_flags,
+ Disjunction([
+ CharacterClass([
+ ["X", "X"],
+ ["Y", "Y"],
+ ]),
+ Atom("\uD83D\uDC38")
+ ]));
+
+test("[X\\u{D83D}Y]", unicode_flags,
+ Disjunction([
+ CharacterClass([
+ ["X", "X"],
+ ["Y", "Y"]
+ ]),
+ Alternative([
+ CharacterClass([
+ ["\uD83D", "\uD83D"]
+ ]),
+ NegativeLookahead(CharacterClass([["\uDC00", "\uDFFF"]]))
+ ])
+ ]));
+test("[X\\u{DC38}Y]", unicode_flags,
+ Disjunction([
+ CharacterClass([
+ ["X", "X"],
+ ["Y", "Y"]
+ ]),
+ Alternative([
+ Assertion("NOT_AFTER_LEAD_SURROGATE"),
+ CharacterClass([
+ ["\uDC38", "\uDC38"]
+ ])
+ ])
+ ]));
+
+// Invalid
+
+test("[\\u]", no_unicode_flags,
+ CharacterClass([
+ ["u", "u"]
+ ]));
+
+test("[\\uG]", no_unicode_flags,
+ CharacterClass([
+ ["u", "u"],
+ ["G", "G"]
+ ]));
+
+test("[\\uD83]", no_unicode_flags,
+ CharacterClass([
+ ["u", "u"],
+ ["D", "D"],
+ ["8", "8"],
+ ["3", "3"]
+ ]));
+
+test("[\\uD83G]", no_unicode_flags,
+ CharacterClass([
+ ["u", "u"],
+ ["D", "D"],
+ ["8", "8"],
+ ["3", "3"],
+ ["G", "G"]
+ ]));