Index: test/mjsunit/harmony/unicode-escapes-in-regexps.js |
diff --git a/test/mjsunit/harmony/unicode-escapes-in-regexps.js b/test/mjsunit/harmony/unicode-escapes-in-regexps.js |
index 67493351a4c062bb0beae6fd0b373421cbbb4699..a4c5c5f0f245d46eb8e2303fa5096b884a64c5e5 100644 |
--- a/test/mjsunit/harmony/unicode-escapes-in-regexps.js |
+++ b/test/mjsunit/harmony/unicode-escapes-in-regexps.js |
@@ -210,3 +210,40 @@ function testRegexpHelper(r) { |
helper(/foo/u); |
helper(new RegExp("foo", "u")); |
})(); |
+ |
+// Non-BMP patterns. |
+// Single character atom. |
+assertTrue(new RegExp("\u{12345}", "u").test("\u{12345}")); |
+assertTrue(/\u{12345}/u.test("\u{12345}")); |
+assertTrue(new RegExp("\u{12345}", "u").test("\ud808\udf45")); |
+assertTrue(/\u{12345}/u.test("\ud808\udf45")); |
+assertFalse(new RegExp("\u{12345}", "u").test("\udf45")); |
+assertFalse(/\u{12345}/u.test("\udf45")); |
+ |
+// Multi-character atom. |
+assertTrue(new RegExp("\u{12345}\u{23456}", "u").test("a\u{12345}\u{23456}b")); |
+assertTrue(/\u{12345}\u{23456}/u.test("b\u{12345}\u{23456}c")); |
+assertFalse(new RegExp("\u{12345}\u{23456}", "u").test("a\udf45\u{23456}b")); |
+assertFalse(/\u{12345}\u{23456}/u.test("b\udf45\u{23456}c")); |
+ |
+// Disjunction. |
+assertTrue(new RegExp("\u{12345}(?:\u{23456})", "u").test( |
+ "a\u{12345}\u{23456}b")); |
+assertTrue(/\u{12345}(?:\u{23456})/u.test("b\u{12345}\u{23456}c")); |
+assertFalse(new RegExp("\u{12345}(?:\u{23456})", "u").test( |
+ "a\udf45\u{23456}b")); |
+assertFalse(/\u{12345}(?:\u{23456})/u.test("b\udf45\u{23456}c")); |
+ |
+// Alternative. |
+assertTrue(new RegExp("\u{12345}|\u{23456}", "u").test("a\u{12345}b")); |
+assertTrue(/\u{12345}|\u{23456}/u.test("b\u{23456}c")); |
+assertFalse(new RegExp("\u{12345}|\u{23456}", "u").test("a\udf45\ud84db")); |
+assertFalse(/\u{12345}|\u{23456}/u.test("b\udf45\ud808c")); |
+ |
+// Capture. |
+assertTrue(new RegExp("(\u{12345}|\u{23456}).\\1", "u").test( |
+ "\u{12345}b\u{12345}")); |
+assertTrue(/(\u{12345}|\u{23456}).\1/u.test("\u{12345}b\u{12345}")); |
+assertFalse(new RegExp("(\u{12345}|\u{23456}).\\1", "u").test( |
+ "\u{12345}b\u{23456}")); |
+assertFalse(/(\u{12345}|\u{23456}).\1/u.test("\u{12345}b\u{23456}")); |