mirror of
https://github.com/dart-lang/sdk
synced 2024-09-20 07:21:33 +00:00
c655ecafe4
Successfully migrated 11 tests. Need manual work on 5 tests: - language_2/sync_generator1_test.dart: (TODO) Merge from language/sync_generator1_test.dart into this file. - language_2/syncstar_less_than_test.dart: (TODO) Merge from language/syncstar_less_than_test.dart into this file. - language_2/syncstar_yield_test.dart: (TODO) Merge from language/syncstar_yield_test.dart into this file. - language_2/syncstar_yieldstar_test.dart: (TODO) Merge from language/syncstar_yieldstar_test.dart into this file. - language_2/syntax_test.dart: (TODO) Merge from language/syntax_test.dart into this file. Bug: Change-Id: I894d881a9c1182e6f2c9d190128cc3d0a53faa7f Reviewed-on: https://dart-review.googlesource.com/12385 Commit-Queue: Janice Collins <jcollins@google.com> Reviewed-by: Phil Quitslund <pquitslund@google.com> Reviewed-by: Janice Collins <jcollins@google.com>
30 lines
779 B
Dart
30 lines
779 B
Dart
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
|
|
// 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.
|
|
|
|
// TODO(jmesserly): this is a copy of the language test of the same name,
|
|
// we can remove this copy when we're running against those tests.
|
|
import "package:expect/expect.dart";
|
|
|
|
bar() sync* {
|
|
int i = 1;
|
|
int j = 1;
|
|
while (true) {
|
|
yield i;
|
|
j = i + j;
|
|
i = j - i;
|
|
}
|
|
}
|
|
|
|
foo() sync* {
|
|
yield* [1, 2, 3];
|
|
yield null;
|
|
// TODO(jmesserly): added cast here to work around:
|
|
// https://codereview.chromium.org/1213503002/
|
|
yield* bar() as Iterable;
|
|
}
|
|
|
|
main() async {
|
|
Expect.listEquals([1, 2, 3, null, 1, 1, 2, 3, 5], foo().take(9).toList());
|
|
}
|