| OLD | NEW |
| 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 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 testType(name, future.whenComplete(() {}), depth - 1); | 988 testType(name, future.whenComplete(() {}), depth - 1); |
| 989 } | 989 } |
| 990 } | 990 } |
| 991 | 991 |
| 992 for (var value in [42, null]) { | 992 for (var value in [42, null]) { |
| 993 testType("Future($value)", new Future<int>(() => value)); | 993 testType("Future($value)", new Future<int>(() => value)); |
| 994 testType("Future.delayed($value)", | 994 testType("Future.delayed($value)", |
| 995 new Future<int>.delayed(Duration.ZERO, () => value)); | 995 new Future<int>.delayed(Duration.ZERO, () => value)); |
| 996 testType( | 996 testType( |
| 997 "Future.microtask($value)", new Future<int>.microtask(() => value)); | 997 "Future.microtask($value)", new Future<int>.microtask(() => value)); |
| 998 testType( | 998 testType( //# 01: ok |
| 999 "Future.sync($value)", new Future<int>.sync(() => value)); // #01: ok | 999 "Future.sync($value)", new Future<int>.sync(() => value)); //# 01: conti
nued |
| 1000 testType( //# 01: continued | 1000 testType( //# 01: continued |
| 1001 "Future.sync(future($value))", //# 01: continued | 1001 "Future.sync(future($value))", //# 01: continued |
| 1002 new Future<int>.sync(//# 01: continued | 1002 new Future<int>.sync(//# 01: continued |
| 1003 () => new Future<int>.value(value))); //# 01: continued | 1003 () => new Future<int>.value(value))); //# 01: continued |
| 1004 testType("Future.value($value)", new Future<int>.value(value)); | 1004 testType("Future.value($value)", new Future<int>.value(value)); |
| 1005 } | 1005 } |
| 1006 testType("Completer.future", new Completer<int>().future); | 1006 testType("Completer.future", new Completer<int>().future); |
| 1007 testType("Future.error", new Future<int>.error("ERR")..catchError((_) {})); | 1007 testType("Future.error", new Future<int>.error("ERR")..catchError((_) {})); |
| 1008 } | 1008 } |
| 1009 | 1009 |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1235 return (new StreamController() | 1235 return (new StreamController() |
| 1236 ..add(_result) | 1236 ..add(_result) |
| 1237 ..close()) | 1237 ..close()) |
| 1238 .stream; | 1238 .stream; |
| 1239 } | 1239 } |
| 1240 | 1240 |
| 1241 Future timeout(Duration duration, {onTimeout()}) { | 1241 Future timeout(Duration duration, {onTimeout()}) { |
| 1242 return this; | 1242 return this; |
| 1243 } | 1243 } |
| 1244 } | 1244 } |
| OLD | NEW |