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 |
8 | 8 |
9 function testRegexpHelper(r) { | 9 function testRegexpHelper(r) { |
10 assertTrue(r.test("foo")); | 10 assertTrue(r.test("foo")); |
11 assertTrue(r.test("boo")); | 11 assertTrue(r.test("boo")); |
12 assertFalse(r.test("moo")); | 12 assertFalse(r.test("moo")); |
13 } | 13 } |
14 | 14 |
15 | 15 |
16 (function TestUnicodeEscapes() { | 16 (function TestUnicodeEscapes() { |
17 testRegexpHelper(/(\u0066|\u0062)oo/); | 17 testRegexpHelper(/(\u0066|\u0062)oo/); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 assertNull(new RegExp("\ud800\\udc00+", "u").exec("\u{10000}\u{10000}")); | 278 assertNull(new RegExp("\ud800\\udc00+", "u").exec("\u{10000}\u{10000}")); |
279 | 279 |
280 assertNull(new RegExp("[\\ud800\udc00]", "u").exec("\u{10000}")); | 280 assertNull(new RegExp("[\\ud800\udc00]", "u").exec("\u{10000}")); |
281 assertNull(new RegExp("[\\{ud800}\udc00]", "u").exec("\u{10000}")); | 281 assertNull(new RegExp("[\\{ud800}\udc00]", "u").exec("\u{10000}")); |
282 assertNull(new RegExp("[\ud800\\udc00]", "u").exec("\u{10000}")); | 282 assertNull(new RegExp("[\ud800\\udc00]", "u").exec("\u{10000}")); |
283 assertNull(new RegExp("[\ud800\\{udc00}]", "u").exec("\u{10000}")); | 283 assertNull(new RegExp("[\ud800\\{udc00}]", "u").exec("\u{10000}")); |
284 | 284 |
285 assertNull(/\u{d800}\u{dc00}+/u.exec("\ud800\udc00\udc00")); | 285 assertNull(/\u{d800}\u{dc00}+/u.exec("\ud800\udc00\udc00")); |
286 assertNull(/\ud800\u{dc00}+/u.exec("\ud800\udc00\udc00")); | 286 assertNull(/\ud800\u{dc00}+/u.exec("\ud800\udc00\udc00")); |
287 assertNull(/\u{d800}\udc00+/u.exec("\ud800\udc00\udc00")); | 287 assertNull(/\u{d800}\udc00+/u.exec("\ud800\udc00\udc00")); |
OLD | NEW |