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

Side by Side Diff: tests/lib_strong/async/future_constructor2_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 library future_delayed_test;
6
7 import 'package:async_helper/async_helper.dart';
8 import "package:expect/expect.dart";
9 import 'dart:async';
10
11 Future<int> createIntFuture() {
12 return new Future<int>.value(499);
13 }
14
15 unnamed() {
16 asyncStart();
17 new Future<int>(createIntFuture)
18 .then((x) {
19 Expect.equals(499, x);
20 asyncEnd();
21 });
22 }
23
24 delayed() {
25 asyncStart();
26 new Future<int>.delayed(const Duration(milliseconds: 2), createIntFuture)
27 .then((x) {
28 Expect.equals(499, x);
29 asyncEnd();
30 });
31 }
32
33 microtask() {
34 asyncStart();
35 new Future<int>.microtask(createIntFuture)
36 .then((x) {
37 Expect.equals(499, x);
38 asyncEnd();
39 });
40 }
41
42 sync() {
43 asyncStart();
44 new Future<int>.sync(createIntFuture)
45 .then((x) {
46 Expect.equals(499, x);
47 asyncEnd();
48 });
49 }
50
51 main() {
52 asyncStart();
53 // Test that all the Future constructors take functions that return a Future
54 // as argument.
55 // In particular the constructors must not type their argument as
56 // `T computation()`.
57 unnamed();
58 delayed();
59 microtask();
60 sync();
61 asyncEnd();
62 }
OLDNEW
« no previous file with comments | « tests/lib_strong/async/first_regression_test.dart ('k') | tests/lib_strong/async/future_constructor_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698