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

Side by Side Diff: tests/lib/async/future_constructor2_test.dart

Issue 2999943002: Migrated test block 168 to Dart 2.0. (Closed)
Patch Set: Fixed package:test crash related issues, addressed Bob's comments. Created 3 years, 4 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).then((x) {
18 Expect.equals(499, x);
19 asyncEnd();
20 });
21 }
22
23 delayed() {
24 asyncStart();
25 new Future<int>.delayed(const Duration(milliseconds: 2), createIntFuture)
26 .then((x) {
27 Expect.equals(499, x);
28 asyncEnd();
29 });
30 }
31
32 microtask() {
33 asyncStart();
34 new Future<int>.microtask(createIntFuture).then((x) {
35 Expect.equals(499, x);
36 asyncEnd();
37 });
38 }
39
40 sync() {
41 asyncStart();
42 new Future<int>.sync(createIntFuture).then((x) {
43 Expect.equals(499, x);
44 asyncEnd();
45 });
46 }
47
48 main() {
49 asyncStart();
50 // Test that all the Future constructors take functions that return a Future
51 // as argument.
52 // In particular the constructors must not type their argument as
53 // `T computation()`.
54 unnamed();
55 delayed();
56 microtask();
57 sync();
58 asyncEnd();
59 }
OLDNEW
« no previous file with comments | « tests/lib/async/first_regression_test.dart ('k') | tests/lib/async/future_constructor_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698