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

Side by Side Diff: tests/lib_strong/async/async_await_sync_completer_test.dart

Issue 2802973005: Migrate async tests to strong (Closed)
Patch Set: Created 3 years, 8 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
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 import 'dart:async';
10
11 var events = [];
12 var delayedValue = new Completer();
13 var delayedError = new Completer();
14
15 foo() async {
16 new Future.microtask(() => 'in microtask')
17 .then(events.add)
18 .then(delayedValue.complete);
19 return 'in async function';
20 }
21
22 bar() async {
23 new Future.microtask(() => throw 'in microtask error')
24 .catchError(events.add)
25 .then(delayedError.complete);
26 throw 'in async function error';
27 }
28
29 void main() {
30 asyncStart();
31 var asyncValueFuture = foo().then(events.add);
32 var asyncErrorFuture = bar().catchError(events.add);
33 Future.wait([
34 asyncValueFuture,
35 delayedValue.future,
36 asyncErrorFuture,
37 delayedError.future]).then((_) {
38 // The body completed before nested microtask. So they should appear
39 // before the delayed functions. In other words, the async function should
40 // not unnecessarily delay the propagation of errors and values.
41 Expect.listEquals([
42 "in async function",
43 "in async function error",
44 "in microtask",
45 "in microtask error"],
46 events);
47 asyncEnd();
48 });
49 }
OLDNEW
« no previous file with comments | « pkg/dev_compiler/test/not_yet_strong_tests.dart ('k') | tests/lib_strong/async/async_await_zones_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698