OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 // Flags: --harmony-unicode-regexps --harmony-regexp-lookbehind | 5 // Flags: --harmony-regexp-lookbehind |
6 | 6 |
7 var r = /./ug; | 7 var r = /./ug; |
8 assertEquals(["\ud800\udc00"], r.exec("\ud800\udc00\ud801\udc01")); | 8 assertEquals(["\ud800\udc00"], r.exec("\ud800\udc00\ud801\udc01")); |
9 assertEquals(2, r.lastIndex); | 9 assertEquals(2, r.lastIndex); |
10 r.lastIndex = 1; | 10 r.lastIndex = 1; |
11 assertEquals(["\ud800\udc00"], r.exec("\ud800\udc00\ud801\udc01")); | 11 assertEquals(["\ud800\udc00"], r.exec("\ud800\udc00\ud801\udc01")); |
12 assertEquals(2, r.lastIndex); | 12 assertEquals(2, r.lastIndex); |
13 assertEquals(["\ud801\udc01"], r.exec("\ud800\udc00\ud801\udc01")); | 13 assertEquals(["\ud801\udc01"], r.exec("\ud800\udc00\ud801\udc01")); |
14 r.lastIndex = 3; | 14 r.lastIndex = 3; |
15 assertEquals(["\ud801\udc01"], r.exec("\ud800\udc00\ud801\udc01")); | 15 assertEquals(["\ud801\udc01"], r.exec("\ud800\udc00\ud801\udc01")); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 r = /(?:(^.)|.)/g; | 96 r = /(?:(^.)|.)/g; |
97 assertEquals(["\ud800", "\ud800"], | 97 assertEquals(["\ud800", "\ud800"], |
98 r.exec("\ud800\udc00\ud801\udc01")); | 98 r.exec("\ud800\udc00\ud801\udc01")); |
99 assertEquals(1, r.lastIndex); | 99 assertEquals(1, r.lastIndex); |
100 assertEquals(["\udc00", undefined], r.exec("\ud800\udc00\ud801\udc01")); | 100 assertEquals(["\udc00", undefined], r.exec("\ud800\udc00\ud801\udc01")); |
101 assertEquals(2, r.lastIndex); | 101 assertEquals(2, r.lastIndex); |
102 r.lastIndex = 3; | 102 r.lastIndex = 3; |
103 assertEquals(["\udc01", undefined], r.exec("\ud800\udc00\ud801\udc01")); | 103 assertEquals(["\udc01", undefined], r.exec("\ud800\udc00\ud801\udc01")); |
104 assertEquals(4, r.lastIndex); | 104 assertEquals(4, r.lastIndex); |
OLD | NEW |