OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import "dart:async"; | 5 import "dart:async"; |
6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
7 import "package:async_helper/async_helper.dart"; | 7 import "package:async_helper/async_helper.dart"; |
8 | 8 |
9 class Tracer { | 9 class Tracer { |
10 final String expected; | 10 final String expected; |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 try { | 205 try { |
206 int i = 0; | 206 int i = 0; |
207 while (true) { | 207 while (true) { |
208 try { | 208 try { |
209 try { | 209 try { |
210 tracer.trace("a"); | 210 tracer.trace("a"); |
211 throw "Error"; | 211 throw "Error"; |
212 } catch (error) { | 212 } catch (error) { |
213 tracer.trace("b"); | 213 tracer.trace("b"); |
214 try { | 214 try { |
215 await new Future.value(3); /// forceAwait: continued | 215 await new Future.value(3); // /// forceAwait: continued |
216 throw "Error2"; | 216 throw "Error2"; |
217 } catch(error) { | 217 } catch(error) { |
218 tracer.trace("c"); | 218 tracer.trace("c"); |
219 } finally { | 219 } finally { |
220 tracer.trace("d"); | 220 tracer.trace("d"); |
221 } | 221 } |
222 tracer.trace("e"); | 222 tracer.trace("e"); |
223 throw "Error3"; | 223 throw "Error3"; |
224 } finally { | 224 } finally { |
225 tracer.trace("f"); | 225 tracer.trace("f"); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 try { | 301 try { |
302 try { | 302 try { |
303 tracer.trace("a"); | 303 tracer.trace("a"); |
304 return; | 304 return; |
305 } catch (error) { | 305 } catch (error) { |
306 tracer.trace("b"); | 306 tracer.trace("b"); |
307 } finally { | 307 } finally { |
308 tracer.trace("c"); | 308 tracer.trace("c"); |
309 try { | 309 try { |
310 try { | 310 try { |
311 await new Future.value(3); /// forceAwait: continued | 311 await new Future.value(3); // /// forceAwait: continued |
312 tracer.trace("d"); | 312 tracer.trace("d"); |
313 throw "Error"; | 313 throw "Error"; |
314 } finally { | 314 } finally { |
315 tracer.trace("e"); | 315 tracer.trace("e"); |
316 } | 316 } |
317 } finally { | 317 } finally { |
318 tracer.trace("f"); | 318 tracer.trace("f"); |
319 } | 319 } |
320 } | 320 } |
321 } finally { | 321 } finally { |
322 tracer.trace("g"); | 322 tracer.trace("g"); |
323 } | 323 } |
324 tracer.trace("h"); | 324 tracer.trace("h"); |
325 } | 325 } |
326 | 326 |
327 foo14(Tracer tracer) async { | 327 foo14(Tracer tracer) async { |
328 try { | 328 try { |
329 try { | 329 try { |
330 tracer.trace("a"); | 330 tracer.trace("a"); |
331 throw "Error"; | 331 throw "Error"; |
332 } catch (error) { | 332 } catch (error) { |
333 tracer.trace("b"); | 333 tracer.trace("b"); |
334 try { | 334 try { |
335 await new Future.value(3); /// forceAwait: continued | 335 await new Future.value(3); // /// forceAwait: continued |
336 throw "Error2"; | 336 throw "Error2"; |
337 } catch(error) { | 337 } catch(error) { |
338 tracer.trace("c"); | 338 tracer.trace("c"); |
339 } finally { | 339 } finally { |
340 tracer.trace("d"); | 340 tracer.trace("d"); |
341 } | 341 } |
342 tracer.trace("e"); | 342 tracer.trace("e"); |
343 throw "Error3"; | 343 throw "Error3"; |
344 } finally { | 344 } finally { |
345 tracer.trace("f"); | 345 tracer.trace("f"); |
346 } | 346 } |
347 } finally { | 347 } finally { |
348 tracer.trace("g"); | 348 tracer.trace("g"); |
349 } | 349 } |
350 tracer.trace("h"); | 350 tracer.trace("h"); |
351 } | 351 } |
352 | 352 |
353 foo15(Tracer tracer) async { | 353 foo15(Tracer tracer) async { |
354 try { | 354 try { |
355 try { | 355 try { |
356 tracer.trace("a"); | 356 tracer.trace("a"); |
357 throw "Error"; | 357 throw "Error"; |
358 } catch (error) { | 358 } catch (error) { |
359 tracer.trace("b"); | 359 tracer.trace("b"); |
360 try { | 360 try { |
361 await new Future.value(3); /// forceAwait: continued | 361 await new Future.value(3); // /// forceAwait: continued |
362 throw "Error2"; | 362 throw "Error2"; |
363 } catch(error) { | 363 } catch(error) { |
364 tracer.trace("c"); | 364 tracer.trace("c"); |
365 } finally { | 365 } finally { |
366 tracer.trace("d"); | 366 tracer.trace("d"); |
367 } | 367 } |
368 tracer.trace("e"); | 368 tracer.trace("e"); |
369 throw "Error3"; | 369 throw "Error3"; |
370 } finally { | 370 } finally { |
371 tracer.trace("f"); | 371 tracer.trace("f"); |
372 return; | 372 return; |
373 } | 373 } |
374 } finally { | 374 } finally { |
375 tracer.trace("g"); | 375 tracer.trace("g"); |
376 } | 376 } |
377 tracer.trace("h"); | 377 tracer.trace("h"); |
378 } | 378 } |
379 | 379 |
380 foo16(Tracer tracer) async { | 380 foo16(Tracer tracer) async { |
381 try { | 381 try { |
382 try { | 382 try { |
383 tracer.trace("a"); | 383 tracer.trace("a"); |
384 throw "Error"; | 384 throw "Error"; |
385 } catch (error) { | 385 } catch (error) { |
386 tracer.trace("b"); | 386 tracer.trace("b"); |
387 try { | 387 try { |
388 await new Future.value(3); /// forceAwait: continued | 388 await new Future.value(3); // /// forceAwait: continued |
389 throw "Error2"; | 389 throw "Error2"; |
390 } catch(error) { | 390 } catch(error) { |
391 tracer.trace("c"); | 391 tracer.trace("c"); |
392 } finally { | 392 } finally { |
393 tracer.trace("d"); | 393 tracer.trace("d"); |
394 return; | 394 return; |
395 } | 395 } |
396 tracer.trace("e"); | 396 tracer.trace("e"); |
397 throw "Error3"; | 397 throw "Error3"; |
398 } finally { | 398 } finally { |
399 tracer.trace("f"); | 399 tracer.trace("f"); |
400 } | 400 } |
401 } finally { | 401 } finally { |
402 tracer.trace("g"); | 402 tracer.trace("g"); |
403 } | 403 } |
404 tracer.trace("h"); | 404 tracer.trace("h"); |
405 } | 405 } |
406 | 406 |
407 foo17(Tracer tracer) async { | 407 foo17(Tracer tracer) async { |
408 try { | 408 try { |
409 tracer.trace("a"); | 409 tracer.trace("a"); |
410 } finally { | 410 } finally { |
411 try { | 411 try { |
412 tracer.trace("b"); | 412 tracer.trace("b"); |
413 throw "Error"; | 413 throw "Error"; |
414 } catch (error) { | 414 } catch (error) { |
415 await new Future.value(3); /// forceAwait: continued | 415 await new Future.value(3); // /// forceAwait: continued |
416 Expect.equals("Error", error); | 416 Expect.equals("Error", error); |
417 tracer.trace("c"); | 417 tracer.trace("c"); |
418 } finally { | 418 } finally { |
419 tracer.trace("d"); | 419 tracer.trace("d"); |
420 } | 420 } |
421 tracer.trace("e"); | 421 tracer.trace("e"); |
422 } | 422 } |
423 tracer.trace("f"); | 423 tracer.trace("f"); |
424 } | 424 } |
425 | 425 |
426 foo18(Tracer tracer) async { | 426 foo18(Tracer tracer) async { |
427 try { | 427 try { |
428 tracer.trace("a"); | 428 tracer.trace("a"); |
429 } finally { | 429 } finally { |
430 try { | 430 try { |
431 tracer.trace("b"); | 431 tracer.trace("b"); |
432 } finally { | 432 } finally { |
433 await new Future.value(3); /// forceAwait: continued | 433 await new Future.value(3); // /// forceAwait: continued |
434 tracer.trace("c"); | 434 tracer.trace("c"); |
435 } | 435 } |
436 tracer.trace("d"); | 436 tracer.trace("d"); |
437 } | 437 } |
438 tracer.trace("e"); | 438 tracer.trace("e"); |
439 } | 439 } |
440 | 440 |
441 runTest(expectedTrace, fun, [expectedError]) async { | 441 runTest(expectedTrace, fun, [expectedError]) async { |
442 Tracer tracer = new Tracer(expectedTrace, expectedTrace); | 442 Tracer tracer = new Tracer(expectedTrace, expectedTrace); |
443 try { | 443 try { |
(...skipping 23 matching lines...) Expand all Loading... |
467 await runTest("abcdefgX", foo14, "Error3"); | 467 await runTest("abcdefgX", foo14, "Error3"); |
468 await runTest("abcdefg", foo15); | 468 await runTest("abcdefg", foo15); |
469 await runTest("abcdfg", foo16); | 469 await runTest("abcdfg", foo16); |
470 await runTest("abcdef", foo17); | 470 await runTest("abcdef", foo17); |
471 await runTest("abcde", foo18); | 471 await runTest("abcde", foo18); |
472 } | 472 } |
473 | 473 |
474 void main() { | 474 void main() { |
475 asyncTest(test); | 475 asyncTest(test); |
476 } | 476 } |
OLD | NEW |