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

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: Address comments. 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/asyncstar_concat_test.dart b/tests/language/async_star_stream_take_test.dart
similarity index 56%
copy from tests/language/asyncstar_concat_test.dart
copy to tests/language/async_star_stream_take_test.dart
index aeb1361cd85fdcc35bf1fd466b161c2462befc4e..095082b0a36bca0fda34f50b2a6a6bcce58da1d4 100644
--- a/tests/language/asyncstar_concat_test.dart
+++ b/tests/language/async_star_stream_take_test.dart
@@ -2,28 +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";
-range(start, end) async* {
- for (int i = start; i < end; i++) {
- yield i;
- }
-}
-
-concat(a, b) async* {
- yield* a;
- yield* b;
-}
-
-test() async {
- Expect.listEquals([1, 2, 3, 11, 12, 13],
- await concat(range(1, 4), range(11, 14)).toList());
+Stream makeStream(int n) async* {
+ for (int i = 0; i < n; i++) yield i;
}
main() {
+ f(Stream s) async {
+ var r = 0;
+ await for(var v in s.take(5)) r += v;
+ return r;
+ }
+
asyncStart();
- test().then((_) {
+ f(makeStream(10)).then((v) {
+ Expect.equals(10, v);
asyncEnd();
});
-}
+}
+
« no previous file with comments | « tests/language/async_star_regression_fisk_test.dart ('k') | tests/language/async_star_take_reyield_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698