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

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

Issue 2788103002: Fix test that assumed an async function returned a Future<not-dynamic>. (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library future_test; 5 library future_test;
6 6
7 import 'package:async_helper/async_helper.dart'; 7 import 'package:async_helper/async_helper.dart';
8 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
9 import 'dart:async'; 9 import 'dart:async';
10 10
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 testType(name, future.whenComplete(() {}), depth - 1); 987 testType(name, future.whenComplete(() {}), depth - 1);
988 } 988 }
989 } 989 }
990 990
991 for (var value in [42, null]) { 991 for (var value in [42, null]) {
992 testType("Future($value)", new Future<int>(() => value)); 992 testType("Future($value)", new Future<int>(() => value));
993 testType("Future.delayed($value)", 993 testType("Future.delayed($value)",
994 new Future<int>.delayed(Duration.ZERO, () => value)); 994 new Future<int>.delayed(Duration.ZERO, () => value));
995 testType( 995 testType(
996 "Future.microtask($value)", new Future<int>.microtask(() => value)); 996 "Future.microtask($value)", new Future<int>.microtask(() => value));
997 testType("Future.sync($value)", new Future<int>.sync(() => value)); // // # 01: ok 997 testType("Future.sync($value)", new Future<int>.sync(() => value)); //# 01: ok
998 testType("Future.sync(future($value))", // // # 01: continued 998 testType("Future.sync(future($value))", // //# 01: continued
999 new Future<int>.sync(() async => new Future<int>.value(value))); // # 01: continued 999 new Future<int>.sync(() => new Future<int>.value(value))); //# 01: continued
1000 testType("Future.value($value)", new Future<int>.value(value)); 1000 testType("Future.value($value)", new Future<int>.value(value));
1001 } 1001 }
1002 testType("Completer.future", new Completer<int>().future); 1002 testType("Completer.future", new Completer<int>().future);
1003 testType("Future.error", new Future<int>.error("ERR")..catchError((_) {})); 1003 testType("Future.error", new Future<int>.error("ERR")..catchError((_) {}));
1004 } 1004 }
1005 1005
1006 void testAnyValue() { 1006 void testAnyValue() {
1007 asyncStart(); 1007 asyncStart();
1008 var cs = new List.generate(3, (_) => new Completer()); 1008 var cs = new List.generate(3, (_) => new Completer());
1009 var result = Future.any(cs.map((x) => x.future)); 1009 var result = Future.any(cs.map((x) => x.future));
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 return (new StreamController() 1231 return (new StreamController()
1232 ..add(_result) 1232 ..add(_result)
1233 ..close()) 1233 ..close())
1234 .stream; 1234 .stream;
1235 } 1235 }
1236 1236
1237 Future timeout(Duration duration, {onTimeout()}) { 1237 Future timeout(Duration duration, {onTimeout()}) {
1238 return this; 1238 return this;
1239 } 1239 }
1240 } 1240 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698