OLD | NEW |
1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 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-regexp-dotall | 5 // Flags: --harmony-regexp-dotall |
6 | 6 |
7 function toSlowMode(re) { | 7 function toSlowMode(re) { |
8 re.exec = (str) => RegExp.prototype.exec.call(re, str); | 8 re.exec = (str) => RegExp.prototype.exec.call(re, str); |
9 return re; | 9 return re; |
10 } | 10 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 re = /./gimyu; | 49 re = /./gimyu; |
50 assertEquals("gimuy", re.flags); | 50 assertEquals("gimuy", re.flags); |
51 assertTrue(re.global); | 51 assertTrue(re.global); |
52 assertTrue(re.ignoreCase); | 52 assertTrue(re.ignoreCase); |
53 assertTrue(re.multiline); | 53 assertTrue(re.multiline); |
54 assertTrue(re.sticky); | 54 assertTrue(re.sticky); |
55 assertTrue(re.unicode); | 55 assertTrue(re.unicode); |
56 assertFalse(re.dotAll); | 56 assertFalse(re.dotAll); |
57 } | 57 } |
58 | 58 |
| 59 // Different construction variants with all flags. |
| 60 { |
| 61 assertEquals("gimsuy", new RegExp("", "yusmig").flags); |
| 62 assertEquals("gimsuy", new RegExp().compile("", "yusmig").flags); |
| 63 } |
| 64 |
59 // Default '.' behavior. | 65 // Default '.' behavior. |
60 { | 66 { |
61 let re = /^.$/; | 67 let re = /^.$/; |
62 assertTrue(re.test("a")); | 68 assertTrue(re.test("a")); |
63 assertTrue(re.test("3")); | 69 assertTrue(re.test("3")); |
64 assertTrue(re.test("π")); | 70 assertTrue(re.test("π")); |
65 assertTrue(re.test("\u2027")); | 71 assertTrue(re.test("\u2027")); |
66 assertTrue(re.test("\u0085")); | 72 assertTrue(re.test("\u0085")); |
67 assertTrue(re.test("\v")); | 73 assertTrue(re.test("\v")); |
68 assertTrue(re.test("\f")); | 74 assertTrue(re.test("\f")); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 assertTrue(re.test("\u0085")); | 126 assertTrue(re.test("\u0085")); |
121 assertTrue(re.test("\v")); | 127 assertTrue(re.test("\v")); |
122 assertTrue(re.test("\f")); | 128 assertTrue(re.test("\f")); |
123 assertTrue(re.test("\u180E")); | 129 assertTrue(re.test("\u180E")); |
124 assertTrue(re.test("\u{10300}")); // Supplementary plane. | 130 assertTrue(re.test("\u{10300}")); // Supplementary plane. |
125 assertTrue(re.test("\n")); | 131 assertTrue(re.test("\n")); |
126 assertTrue(re.test("\r")); | 132 assertTrue(re.test("\r")); |
127 assertTrue(re.test("\u2028")); | 133 assertTrue(re.test("\u2028")); |
128 assertTrue(re.test("\u2029")); | 134 assertTrue(re.test("\u2029")); |
129 } | 135 } |
OLD | NEW |