| Index: tests/corelib/iterable_expand_test.dart
|
| diff --git a/tests/corelib/iterable_expand_test.dart b/tests/corelib/iterable_expand_test.dart
|
| index 5737a9b24cab8305605dcbc02a879f23ab0fe6d1..9c60541f2f41523200972ef83f8ecd1337e06204 100644
|
| --- a/tests/corelib/iterable_expand_test.dart
|
| +++ b/tests/corelib/iterable_expand_test.dart
|
| @@ -3,6 +3,21 @@
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| import "package:expect/expect.dart";
|
| +import 'dart:collection';
|
| +
|
| +class MyList extends ListBase {
|
| + List list;
|
| + MyList(this.list);
|
| +
|
| + get length => list.length;
|
| + set length(val) { list.length = val; }
|
| +
|
| + operator [](index) => list[index];
|
| + operator []=(index, val) => list[index] = val;
|
| +
|
| + String toString() => "[" + join(", ") + "]";
|
| +}
|
| +
|
|
|
| main() {
|
| test(expectation, iterable) {
|
| @@ -25,6 +40,16 @@ main() {
|
| test([1, 1, 2, 2, 3, 3], [1, 2, 3].expand((x) => [x, x]));
|
| test([1, 1, 2], [1, 2, 3].expand((x) => [x, x, x].skip(x)));
|
|
|
| + test([1], new MyList([1]).expand((x) => [x]));
|
| + test([1, 2, 3], new MyList([1, 2, 3]).expand((x) => [x]));
|
| +
|
| + test([], new MyList([1]).expand((x) => []));
|
| + test([], new MyList([1, 2, 3]).expand((x) => []));
|
| + test([2], new MyList([1, 2, 3]).expand((x) => x == 2 ? [2] : []));
|
| +
|
| + test([1, 1, 2, 2, 3, 3], new MyList([1, 2, 3]).expand((x) => [x, x]));
|
| + test([1, 1, 2], new MyList([1, 2, 3]).expand((x) => [x, x, x].skip(x)));
|
| +
|
| // if function throws, iteration is stopped.
|
| Iterable iterable = [1, 2, 3].expand((x) {
|
| if (x == 2) throw "FAIL";
|
|
|