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 | 5 |
6 { // yield in try-catch | 6 { // yield in try-catch |
7 | 7 |
8 let g = function*() { | 8 let g = function*() { |
9 try {yield 1} catch (error) {assertEquals("caught", error)} | 9 try {yield 1} catch (error) {assertEquals("caught", error)} |
10 }; | 10 }; |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 assertEquals({value: 43, done: false}, x.next(666)); | 231 assertEquals({value: 43, done: false}, x.next(666)); |
232 assertEquals({value: undefined, done: false}, x.next()); | 232 assertEquals({value: undefined, done: false}, x.next()); |
233 assertEquals({value: undefined, done: true}, x.next()); | 233 assertEquals({value: undefined, done: true}, x.next()); |
234 } | 234 } |
235 | 235 |
236 { | 236 { |
237 let x = g(); | 237 let x = g(); |
238 assertEquals({value: 1, done: false}, x.next()); | 238 assertEquals({value: 1, done: false}, x.next()); |
239 assertEquals({value: 42, done: false}, x.next()); | 239 assertEquals({value: 42, done: false}, x.next()); |
240 assertEquals({value: 43, done: false}, x.return(666)); | 240 assertEquals({value: 43, done: false}, x.return(666)); |
241 assertEquals({value: 666, done: false}, x.next()); | 241 assertEquals({value: undefined, done: false}, x.next()); |
242 assertEquals({value: undefined, done: true}, x.next()); | 242 assertEquals({value: undefined, done: true}, x.next()); |
243 } | 243 } |
244 | 244 |
245 { | 245 { |
246 let x = g(); | 246 let x = g(); |
247 assertEquals({value: 1, done: false}, x.next()); | 247 assertEquals({value: 1, done: false}, x.next()); |
248 assertEquals({value: 42, done: false}, x.next()); | 248 assertEquals({value: 42, done: false}, x.next()); |
249 assertEquals({value: 43, done: false}, x.throw(666)); | 249 assertEquals({value: 43, done: false}, x.throw(666)); |
250 assertThrowsEquals(() => x.next(), 666); | 250 assertThrowsEquals(() => x.next(), 666); |
251 } | 251 } |
252 } | 252 } |
OLD | NEW |