Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: tests/language/await_exceptions_test.dart

Issue 542893004: Bubble up exceptions throw async/await. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: addressed comments Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/symbols.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
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.
4
5 // VMOptions=--enable_async --optimization-counter-threshold=5
6
7 import 'package:expect/expect.dart';
8
9 import 'dart:async';
10
11 // It does not matter where a future is generated.
12 bar(p) async => p;
13 baz(p) => new Future(() => p);
14
15 test0_1() async {
16 throw 1;
17 }
18
19 test0() async {
20 try {
21 await test0_1();
22 } catch (e) {
23 Expect.equals(1, e);
24 }
25 }
26
27 test1_1() async {
28 throw 1;
29 }
30
31 test1_2() async {
32 try {
33 await test1_1();
34 } catch (e) {
35 throw e+1;
36 }
37 }
38
39 test1() async {
40 try {
41 await test1_2();
42 } catch (e) {
43 Expect.equals(2, e);
44 }
45 }
46
47 test2() async {
48 var x;
49 var test2_1 = () async {
50 try {
51 throw 'a';
52 } catch (e) {
53 throw e + 'b';
54 }
55 };
56 try {
57 try {
58 await test2_1();
59 } catch (e) {
60 var y = await bar(e + 'c');
61 throw y;
62 }
63 } catch (e) {
64 x = e + 'd';
65 return '?';
66 } finally {
67 return x;
68 }
69 return '!';
70 }
71
72 main() async {
73 var result;
74 for (int i = 0; i < 10; i++) {
75 await test0();
76 await test1();
77 result = await test2();
78 Expect.equals('abcd', result);
79 }
80 }
OLDNEW
« no previous file with comments | « runtime/vm/symbols.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698