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

Unified Diff: tests/language/asyncstar_concat_test.dart

Issue 902783008: The execution of an async* should only be scheduled when the stream is (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase Created 5 years, 10 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
« no previous file with comments | « sdk/lib/_internal/compiler/js_lib/js_helper.dart ('k') | tests/language/language.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/asyncstar_concat_test.dart
diff --git a/tests/language/await_not_started_immediately_test.dart b/tests/language/asyncstar_concat_test.dart
similarity index 50%
copy from tests/language/await_not_started_immediately_test.dart
copy to tests/language/asyncstar_concat_test.dart
index 035885e09c23480054e0dcf5c31ff63ca3a35963..aeb1361cd85fdcc35bf1fd466b161c2462befc4e 100644
--- a/tests/language/await_not_started_immediately_test.dart
+++ b/tests/language/asyncstar_concat_test.dart
@@ -2,21 +2,28 @@
// 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.
-// Test that an async function does not start immediately.
-
import "package:expect/expect.dart";
import "package:async_helper/async_helper.dart";
-var x = 0;
+range(start, end) async* {
+ for (int i = start; i < end; i++) {
+ yield i;
+ }
+}
+
+concat(a, b) async* {
+ yield* a;
+ yield* b;
+}
-foo() async {
- x++;
- await 1;
- x++;
+test() async {
+ Expect.listEquals([1, 2, 3, 11, 12, 13],
+ await concat(range(1, 4), range(11, 14)).toList());
}
-void main() {
+main() {
asyncStart();
- foo().then((_) => Expect.equals(2, x)).whenComplete(asyncEnd);
- Expect.equals(0, x);
+ test().then((_) {
+ asyncEnd();
+ });
}
« no previous file with comments | « sdk/lib/_internal/compiler/js_lib/js_helper.dart ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698