in LibTest/collection/IterableMixin/IterableMixin_class_A01_t02.dart [184:251]
void check2(MyIterable myIterable) {
Expect.equals(1, myIterable.first);
Expect.isFalse(myIterable.isEmpty);
Expect.isTrue(myIterable.isNotEmpty);
Expect.equals(2, myIterable.last);
Expect.equals(2, myIterable.length);
Expect.throws(() => myIterable.single, (e) => e is StateError);
Expect.isTrue(myIterable.any((element) => true));
Expect.isTrue(myIterable.contains(2));
Expect.equals(2, myIterable.elementAt(1));
Expect.isTrue(myIterable.every((element) => true));
Iterable expanded = myIterable.expand((var element) => [element]);
Expect.equals(2, expanded.length);
Expect.equals(1, myIterable.firstWhere((element) => true));
Expect.equals(3, myIterable.fold<int>(0, (int prev, element) => prev + element as int));
Expect.throws(() {
myIterable.forEach((e) {
throw new Exception();
});
});
Expect.equals("1,2", myIterable.join(","));
Expect.equals(2, myIterable.lastWhere((element) => true));
Expect.isFalse(myIterable.map((element) => element).isEmpty);
Expect.equals(3, myIterable.reduce((value, element) => value + element));
Expect.throws(() {
myIterable.singleWhere((element) => true);
}, (e) => e is StateError);
Expect.isFalse(myIterable.skip(0).isEmpty);
Expect.throws(() {
myIterable.skip(-1);
});
Expect.isFalse(myIterable.skipWhile((element) => false).isEmpty);
Expect.isFalse(myIterable.take(1).isEmpty);
Expect.throws(() {
myIterable.take(-1);
});
Expect.isFalse(myIterable.takeWhile((element) => true).isEmpty);
Expect.isTrue(myIterable.takeWhile((element) => false).isEmpty);
Expect.isFalse(myIterable.toList().isEmpty);
Expect.isFalse(myIterable.toList(growable: false).isEmpty);
Expect.isFalse(myIterable.toSet().isEmpty);
Expect.isFalse(myIterable.where((element) => true).isEmpty);
}