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

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

Issue 929053005: Merge request - fixes dart2js async problems. Base URL: http://dart.googlecode.com/svn/trunk/dart/
Patch Set: 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
« no previous file with comments | « tests/language/async_throw_in_catch_test.dart ('k') | tests/language/language.status » ('j') | 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) 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 import "package:expect/expect.dart";
7 import "package:async_helper/async_helper.dart";
8
9 class Tracer {
10 final String expected;
11 final String name;
12 int counter = 0;
13
14 Tracer(this.expected, [this.name]);
15
16 void trace(msg) {
17 if (name != null) {
18 print("Tracing $name: $msg");
19 }
20 Expect.equals(expected[counter], msg);
21 counter++;
22 }
23
24 void done() {
25 Expect.equals(expected.length, counter, "Received too few traces");
26 }
27 }
28
29 foo1(Tracer tracer) async* {
30 try {
31 tracer.trace("a");
32 await new Future.value(3);
33 tracer.trace("b");
34 throw "Error";
35 } catch (e) {
36 tracer.trace("c");
37 yield 1;
38 tracer.trace("d");
39 yield 2;
40 tracer.trace("e");
41 await new Future.error("Error2");
42 } finally {
43 tracer.trace("f");
44 }
45 tracer.trace("g");
46 }
47
48 test() async {
49 Tracer tracer;
50
51 Completer foo1Done = new Completer();
52 tracer = new Tracer("abcdf");
53 var subscription;
54 subscription = foo1(tracer).listen((event) async {
55 await subscription.cancel();
56 tracer.done();
57 foo1Done.complete(null);
58 });
59 await foo1Done.future;
60 }
61
62
63 void main() {
64 asyncTest(test);
65 }
OLDNEW
« no previous file with comments | « tests/language/async_throw_in_catch_test.dart ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698