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

Unified Diff: tests/language/async_star_stream_take_test.dart

Issue 1270413002: Factor failing tests out of language/async_star_test.dart (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add timeout on browsers. Created 5 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 side-by-side diff with in-line comments
Download patch
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();
+ });
}
+

Powered by Google App Engine
This is Rietveld 408576698