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: --allow-natives-syntax --harmony-async-await --expose-debug-as debug | 5 // Flags: --allow-natives-syntax --harmony-async-await --expose-debug-as debug |
6 | 6 |
7 Debug = debug.Debug | 7 Debug = debug.Debug |
8 | 8 |
9 let exception = null; | 9 let exception = null; |
10 let events = 0; | 10 let events = 0; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 } catch (e) { | 104 } catch (e) { |
105 } | 105 } |
106 } | 106 } |
107 | 107 |
108 let catches = [caught, indirectCaught, indirectAwaitCatch]; | 108 let catches = [caught, indirectCaught, indirectAwaitCatch]; |
109 let noncatches = [uncaught, indirectUncaught]; | 109 let noncatches = [uncaught, indirectUncaught]; |
110 let lateCatches = [dotCatch, indirectReturnDotCatch, indirectAwaitDotCatch, nest
edDotCatch]; | 110 let lateCatches = [dotCatch, indirectReturnDotCatch, indirectAwaitDotCatch, nest
edDotCatch]; |
111 | 111 |
112 let throws = [thrower, reject, argThrower, suppressThrow]; | 112 let throws = [thrower, reject, argThrower, suppressThrow]; |
113 let nonthrows = [awaitReturn, scalar, nothing]; | 113 let nonthrows = [awaitReturn, scalar, nothing]; |
114 // TODO(littledan): Build a dependency graph to track the relationship between P
romises | 114 let lateThrows = [awaitThrow, constructorThrow]; |
115 // linked by async/await, and enable tests so that | 115 let uncatchables = [rejectConstructor]; |
116 // let lateThrows = [awaitThrow, constructorThrow, rejectConstructor]; | |
117 let lateThrows = []; | |
118 | 116 |
119 let cases = []; | 117 let cases = []; |
120 | 118 |
121 for (let producer of throws.concat(lateThrows)) { | 119 for (let producer of throws.concat(lateThrows)) { |
122 for (let consumer of catches) { | 120 for (let consumer of catches) { |
123 cases.push({ producer, consumer, expectedEvents: 1, caught: true }); | 121 cases.push({ producer, consumer, expectedEvents: 1, caught: true }); |
124 cases.push({ producer, consumer, expectedEvents: 0, caught: false }); | 122 cases.push({ producer, consumer, expectedEvents: 0, caught: false }); |
125 } | 123 } |
126 } | 124 } |
127 | 125 |
128 for (let producer of throws.concat(lateThrows)) { | 126 for (let producer of throws.concat(lateThrows)) { |
129 for (let consumer of noncatches) { | 127 for (let consumer of noncatches) { |
130 cases.push({ producer, consumer, expectedEvents: 1, caught: true }); | 128 cases.push({ producer, consumer, expectedEvents: 1, caught: true }); |
131 cases.push({ producer, consumer, expectedEvents: 1, caught: false }); | 129 cases.push({ producer, consumer, expectedEvents: 1, caught: false }); |
132 } | 130 } |
133 } | 131 } |
134 | 132 |
135 for (let producer of nonthrows) { | 133 for (let producer of nonthrows) { |
136 for (let consumer of catches.concat(noncatches, lateCatches)) { | 134 for (let consumer of catches.concat(noncatches, lateCatches)) { |
137 cases.push({ producer, consumer, expectedEvents: 0, caught: true }); | 135 cases.push({ producer, consumer, expectedEvents: 0, caught: true }); |
138 cases.push({ producer, consumer, expectedEvents: 0, caught: false }); | 136 cases.push({ producer, consumer, expectedEvents: 0, caught: false }); |
139 } | 137 } |
140 } | 138 } |
141 | 139 |
| 140 for (let producer of uncatchables) { |
| 141 for (let consumer of catches.concat(noncatches, lateCatches)) { |
| 142 cases.push({ producer, consumer, expectedEvents: 1, caught: true }); |
| 143 cases.push({ producer, consumer, expectedEvents: 1, caught: false }); |
| 144 } |
| 145 } |
| 146 |
142 for (let producer of lateThrows) { | 147 for (let producer of lateThrows) { |
143 for (let consumer of lateCatches) { | 148 for (let consumer of lateCatches) { |
144 cases.push({ producer, consumer, expectedEvents: 1, caught: true }); | 149 cases.push({ producer, consumer, expectedEvents: 1, caught: true }); |
145 cases.push({ producer, consumer, expectedEvents: 0, caught: false }); | 150 cases.push({ producer, consumer, expectedEvents: 0, caught: false }); |
146 } | 151 } |
147 } | 152 } |
148 | 153 |
149 for (let producer of throws) { | 154 for (let producer of throws) { |
150 for (let consumer of lateCatches) { | 155 for (let consumer of lateCatches) { |
151 cases.push({ producer, consumer, expectedEvents: 1, caught: true }); | 156 cases.push({ producer, consumer, expectedEvents: 1, caught: true }); |
(...skipping 30 matching lines...) Expand all Loading... |
182 `${expectedEvents} caught ${caught} events ${events} exception ` + | 187 `${expectedEvents} caught ${caught} events ${events} exception ` + |
183 `${exception}`); | 188 `${exception}`); |
184 failureCount++; | 189 failureCount++; |
185 } | 190 } |
186 } | 191 } |
187 | 192 |
188 if (failureCount > 0) { | 193 if (failureCount > 0) { |
189 print(`failureCount ${failureCount}`); | 194 print(`failureCount ${failureCount}`); |
190 quit(1); | 195 quit(1); |
191 } | 196 } |
OLD | NEW |