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

Side by Side Diff: tests/compiler/dart2js_extra/async_stacktrace_test.dart

Issue 945783002: Dart2js async-await. Propagate stacktraces from futures. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix status file Created 5 years, 10 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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import "dart:async";
6
7 import "package:expect/expect.dart";
8 import "package:async_helper/async_helper.dart";
9
10 test1() async
11 * /// asyncStar: ok
12 {
13 var savedStackTrace;
14 try {
15 try {
16 throw "Error";
17 } catch (e, st) {
18 savedStackTrace = st;
19 }
20 await new Future.error("Error 2", savedStackTrace);
21 } catch (e, st) {
22 Expect.equals(savedStackTrace.toString(), st.toString());
floitsch 2015/02/20 12:36:05 Make sure this expect is reached. Same for the oth
sigurdm 2015/02/23 12:41:18 Done.
23 }
24 }
25
26 test2() {
27 var savedStackTrace;
28 foo() async
29 * /// asyncStar: continued
30 {
31 try {
32 // await 3;
33 throw "Error";
34 } catch (e, st) {
35 savedStackTrace = st;
36 }
37 await new Future.error("Error 2", savedStackTrace);
38 }
39 return foo()
40 .toList() /// asyncStar: continued
41 .catchError((e, st) {
42 Expect.equals(savedStackTrace.toString(), st.toString());
43 });
44 }
45
46 test3() {
47 var savedStackTrace;
48 foo() async
49 * /// asyncStar: continued
50 {
51 try {
52 throw "Error";
53 } catch (e, st) {
54 savedStackTrace = st;
55 rethrow;
56 }
57 }
58 return foo()
59 .toList() /// asyncStar: continued
60 .catchError((e, st) {
61 Expect.equals(savedStackTrace.toString(), st.toString());
62 });
63 }
64
65 runTests() async {
66 await test1()
67 .toList() /// asyncStar: continued
68 ;
69 await test2()
70 ;
floitsch 2015/02/20 12:36:05 move ";" to previous line. Same for test3.
sigurdm 2015/02/23 12:41:17 Done.
71 await test3()
72 ;
73 }
74
75 main() {
76 asyncTest(runTests);
77 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698