Chromium Code Reviews| Index: tests/language/async_star_stream_take_test.dart |
| diff --git a/tests/language/async_await_catch_regression_test.dart b/tests/language/async_star_stream_take_test.dart |
| similarity index 57% |
| copy from tests/language/async_await_catch_regression_test.dart |
| copy to tests/language/async_star_stream_take_test.dart |
| index b0df58efdb50daf6866f62e32e138f6cf2805bac..f1f58dc1c78b9bbe9469f4083c07122eaf288416 100644 |
| --- a/tests/language/async_await_catch_regression_test.dart |
| +++ b/tests/language/async_star_stream_take_test.dart |
| @@ -2,25 +2,25 @@ |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| +import "dart:async"; |
| import "package:expect/expect.dart"; |
| import "package:async_helper/async_helper.dart"; |
| -foo() async { |
| - throw 42; |
| +mkStream(int n) async* { |
|
Lasse Reichstein Nielsen
2015/08/06 12:38:41
I'd add "Stream" as return type.
Just because chec
|
| + for (int i = 0; i < n; i++) yield i; |
| } |
| -test() async { |
| - var exception; |
| - try { |
| - await foo(); |
| - } catch (e) { |
| - print(await(e)); |
| - await (exception = await e); |
| +main() { |
| + f(s) async { |
| + var r = 0; |
| + await for(var v in s.take(5)) r += v; |
| + return r; |
| } |
| - Expect.equals(42, exception); |
| -} |
| -main() { |
| asyncStart(); |
| - test().then((_) => asyncEnd()); |
| + f(mkStream(10)).then((v) { |
| + Expect.equals(10, v); |
| + asyncEnd(); |
| + }); |
| } |
| + |