OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // ES6 extends the \uxxxx escape and also allows \u{xxxxx}. | 5 // ES6 extends the \uxxxx escape and also allows \u{xxxxx}. |
6 | 6 |
7 // Flags: --harmony-unicode-regexps --harmony-regexps | 7 // Flags: --harmony-unicode-regexps --harmony-regexps |
8 | 8 |
9 function testRegexpHelper(r) { | 9 function testRegexpHelper(r) { |
10 assertTrue(r.test("foo")); | 10 assertTrue(r.test("foo")); |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 assertFalse(new RegExp("\u{12345}|\u{23456}", "u").test("a\udf45\ud84db")); | 240 assertFalse(new RegExp("\u{12345}|\u{23456}", "u").test("a\udf45\ud84db")); |
241 assertFalse(/\u{12345}|\u{23456}/u.test("b\udf45\ud808c")); | 241 assertFalse(/\u{12345}|\u{23456}/u.test("b\udf45\ud808c")); |
242 | 242 |
243 // Capture. | 243 // Capture. |
244 assertTrue(new RegExp("(\u{12345}|\u{23456}).\\1", "u").test( | 244 assertTrue(new RegExp("(\u{12345}|\u{23456}).\\1", "u").test( |
245 "\u{12345}b\u{12345}")); | 245 "\u{12345}b\u{12345}")); |
246 assertTrue(/(\u{12345}|\u{23456}).\1/u.test("\u{12345}b\u{12345}")); | 246 assertTrue(/(\u{12345}|\u{23456}).\1/u.test("\u{12345}b\u{12345}")); |
247 assertFalse(new RegExp("(\u{12345}|\u{23456}).\\1", "u").test( | 247 assertFalse(new RegExp("(\u{12345}|\u{23456}).\\1", "u").test( |
248 "\u{12345}b\u{23456}")); | 248 "\u{12345}b\u{23456}")); |
249 assertFalse(/(\u{12345}|\u{23456}).\1/u.test("\u{12345}b\u{23456}")); | 249 assertFalse(/(\u{12345}|\u{23456}).\1/u.test("\u{12345}b\u{23456}")); |
| 250 |
| 251 // Quantifier. |
| 252 assertTrue(new RegExp("\u{12345}{3}", "u").test("\u{12345}\u{12345}\u{12345}")); |
| 253 assertTrue(/\u{12345}{3}/u.test("\u{12345}\u{12345}\u{12345}")); |
| 254 assertTrue(new RegExp("\u{12345}{3}").test("\u{12345}\udf45\udf45")); |
| 255 assertTrue(/\ud808\udf45{3}/u.test("\u{12345}\udf45\udf45")); |
| 256 assertFalse(new RegExp("\u{12345}{3}", "u").test("\u{12345}\udf45\udf45")); |
| 257 assertFalse(/\u{12345}{3}/u.test("\u{12345}\udf45\udf45")); |
OLD | NEW |