mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
Cleaning up corelib test migrations.
Change-Id: Ib235c213861f819ed11a887283cad085582eaac7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/132941 Reviewed-by: Nicholas Shahan <nshahan@google.com> Commit-Queue: Mark Zhou <markzipan@google.com>
This commit is contained in:
parent
b00f0ff5fd
commit
e7a524e8c4
|
@ -15,7 +15,6 @@ main() {
|
|||
Iterable<int> skip0 = list1.skip(0);
|
||||
Expect.isTrue(skip0 is! List);
|
||||
Iterator<int> it = skip0.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(1, it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
|
@ -23,45 +22,36 @@ main() {
|
|||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(3, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
Iterable<int> skip1 = list1.skip(1);
|
||||
Expect.isTrue(skip1 is! List);
|
||||
Expect.isTrue(skip1.skip(2).skip(1) is! List);
|
||||
it = skip1.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(2, it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(3, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
Iterable<int> skip2 = list1.skip(2);
|
||||
Expect.isTrue(skip2 is! List);
|
||||
Expect.isTrue(skip2.skip(2).skip(1) is! List);
|
||||
it = skip2.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(3, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
Iterable<int> skip3 = list1.skip(3);
|
||||
Expect.isTrue(skip3 is! List);
|
||||
Expect.isTrue(skip3.skip(2).skip(1) is! List);
|
||||
it = skip3.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
Iterable<int> skip4 = list1.skip(4);
|
||||
Expect.isTrue(skip4 is! List);
|
||||
Expect.isTrue(skip4.skip(2).skip(1) is! List);
|
||||
it = skip4.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
skip0 = list1.skip(0);
|
||||
skip1 = skip0.skip(1);
|
||||
|
@ -69,7 +59,6 @@ main() {
|
|||
skip3 = skip2.skip(1);
|
||||
skip4 = skip3.skip(1);
|
||||
it = skip0.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(1, it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
|
@ -77,83 +66,62 @@ main() {
|
|||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(3, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
it = skip1.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(2, it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(3, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
it = skip2.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(3, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
it = skip3.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
it = skip4.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
skip0 = list2.skip(0);
|
||||
Expect.isTrue(skip0 is! List);
|
||||
Expect.isTrue(skip0.skip(2).skip(1) is! List);
|
||||
it = skip0.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(4, it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(5, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
skip1 = list2.skip(1);
|
||||
Expect.isTrue(skip1 is! List);
|
||||
Expect.isTrue(skip1.skip(2).skip(1) is! List);
|
||||
it = skip1.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(5, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
skip2 = list2.skip(2);
|
||||
Expect.isTrue(skip2 is! List);
|
||||
Expect.isTrue(skip2.skip(2).skip(1) is! List);
|
||||
it = skip2.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
skip3 = list2.skip(3);
|
||||
Expect.isTrue(skip3 is! List);
|
||||
Expect.isTrue(skip3.skip(2).skip(1) is! List);
|
||||
it = skip3.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
Iterable<String> skip02 = list3.skip(0);
|
||||
Expect.isTrue(skip02 is! List);
|
||||
Expect.isTrue(skip02.skip(2).skip(1) is! List);
|
||||
Iterator<String> it2 = skip02.iterator;
|
||||
Expect.isNull(it2.current);
|
||||
Expect.isFalse(it2.moveNext());
|
||||
Expect.isNull(it2.current);
|
||||
|
||||
Iterable<String> skip12 = list3.skip(1);
|
||||
Expect.isTrue(skip12 is! List);
|
||||
Expect.isTrue(skip12.skip(2).skip(1) is! List);
|
||||
it2 = skip12.iterator;
|
||||
Expect.isNull(it2.current);
|
||||
Expect.isFalse(it2.moveNext());
|
||||
Expect.isNull(it2.current);
|
||||
|
||||
skip0 = set1.skip(0);
|
||||
List<int> copied = skip0.toList();
|
||||
|
@ -165,7 +133,6 @@ main() {
|
|||
Expect.isTrue(copied[0] != copied[2]);
|
||||
Expect.isTrue(copied[1] != copied[2]);
|
||||
it = skip0.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.isNotNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
|
@ -173,7 +140,6 @@ main() {
|
|||
Expect.isTrue(it.moveNext());
|
||||
Expect.isNotNull(it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
skip1 = set1.skip(1);
|
||||
copied = skip1.toList();
|
||||
|
@ -182,48 +148,36 @@ main() {
|
|||
Expect.isTrue(set1.contains(copied[1]));
|
||||
Expect.isTrue(copied[0] != copied[1]);
|
||||
it = skip1.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.isNotNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.isNotNull(it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
skip2 = set1.skip(2);
|
||||
copied = skip2.toList();
|
||||
Expect.equals(1, copied.length);
|
||||
Expect.isTrue(set1.contains(copied[0]));
|
||||
it = skip2.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.isNotNull(it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
skip3 = set1.skip(3);
|
||||
it = skip3.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
skip4 = set1.skip(4);
|
||||
it = skip4.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
var dynamicSkip0 = set2.skip(0);
|
||||
var dynamicIt = dynamicSkip0.iterator;
|
||||
Expect.isNull(dynamicIt.current);
|
||||
Expect.isFalse(dynamicIt.moveNext());
|
||||
Expect.isNull(dynamicIt.current);
|
||||
|
||||
var dynamicSkip1 = set2.skip(1);
|
||||
dynamicIt = dynamicSkip1.iterator;
|
||||
Expect.isNull(dynamicIt.current);
|
||||
Expect.isFalse(dynamicIt.moveNext());
|
||||
Expect.isNull(dynamicIt.current);
|
||||
|
||||
testSkipTake(Iterable input, int skip, int take) {
|
||||
List expected = [];
|
||||
|
|
|
@ -14,31 +14,24 @@ main() {
|
|||
|
||||
Iterable<int> skipWhileTrue = list1.skipWhile((x) => true);
|
||||
Iterator<int> it = skipWhileTrue.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
Iterable<int> skipWhileOdd = list1.skipWhile((x) => x.isOdd);
|
||||
it = skipWhileOdd.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(2, it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(3, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
Iterable<int> skipWhileLessThan3 = list1.skipWhile((x) => x < 3);
|
||||
it = skipWhileLessThan3.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(3, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
Iterable<int> skipWhileFalse = list1.skipWhile((x) => false);
|
||||
it = skipWhileFalse.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(1, it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
|
@ -46,11 +39,9 @@ main() {
|
|||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(3, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
Iterable<int> skipWhileEven = list1.skipWhile((x) => x.isEven);
|
||||
it = skipWhileEven.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(1, it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
|
@ -58,59 +49,44 @@ main() {
|
|||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(3, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
skipWhileTrue = list2.skipWhile((x) => true);
|
||||
it = skipWhileTrue.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
skipWhileEven = list2.skipWhile((x) => x.isEven);
|
||||
it = skipWhileEven.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(5, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
skipWhileOdd = list2.skipWhile((x) => x.isOdd);
|
||||
it = skipWhileOdd.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(4, it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(5, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
skipWhileFalse = list2.skipWhile((x) => false);
|
||||
it = skipWhileFalse.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(4, it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(5, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
Iterable<String> skipWhileFalse2 = list3.skipWhile((x) => false);
|
||||
Iterator<String> it2 = skipWhileFalse2.iterator;
|
||||
Expect.isNull(it2.current);
|
||||
Expect.isFalse(it2.moveNext());
|
||||
Expect.isNull(it2.current);
|
||||
|
||||
Iterable<String> skipWhileTrue2 = list3.skipWhile((x) => true);
|
||||
it2 = skipWhileTrue2.iterator;
|
||||
Expect.isNull(it2.current);
|
||||
Expect.isFalse(it2.moveNext());
|
||||
Expect.isNull(it2.current);
|
||||
|
||||
skipWhileTrue = set1.skipWhile((x) => true);
|
||||
it = skipWhileTrue.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
skipWhileFalse = set1.skipWhile((x) => false);
|
||||
List<int> copied = skipWhileFalse.toList();
|
||||
|
@ -122,25 +98,16 @@ main() {
|
|||
Expect.isTrue(copied[0] != copied[2]);
|
||||
Expect.isTrue(copied[1] != copied[2]);
|
||||
it = skipWhileFalse.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.isTrue(it.current != null);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.isTrue(it.current != null);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.isTrue(it.current != null);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
var dynamicSkipWhileTrue = set2.skipWhile((x) => true);
|
||||
var dynamicIt = dynamicSkipWhileTrue.iterator;
|
||||
Expect.isNull(dynamicIt.current);
|
||||
Expect.isFalse(dynamicIt.moveNext());
|
||||
Expect.isNull(dynamicIt.current);
|
||||
|
||||
var dynamicSkipWhileFalse = set2.skipWhile((x) => false);
|
||||
dynamicIt = dynamicSkipWhileFalse.iterator;
|
||||
Expect.isNull(dynamicIt.current);
|
||||
Expect.isFalse(dynamicIt.moveNext());
|
||||
Expect.isNull(dynamicIt.current);
|
||||
}
|
||||
|
|
|
@ -14,31 +14,24 @@ main() {
|
|||
|
||||
Iterable<int> take0 = list1.take(0);
|
||||
Iterator<int> it = take0.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
Iterable<int> take1 = list1.take(1);
|
||||
it = take1.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(1, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
Iterable<int> take2 = list1.take(2);
|
||||
it = take2.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(1, it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(2, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
Iterable<int> take3 = list1.take(3);
|
||||
it = take3.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(1, it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
|
@ -46,11 +39,9 @@ main() {
|
|||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(3, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
Iterable<int> take4 = list1.take(4);
|
||||
it = take4.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(1, it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
|
@ -58,7 +49,6 @@ main() {
|
|||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(3, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
take4 = list1.take(4);
|
||||
take3 = take4.take(3);
|
||||
|
@ -66,25 +56,18 @@ main() {
|
|||
take1 = take2.take(1);
|
||||
take0 = take1.take(0);
|
||||
it = take0.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
it = take1.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(1, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
it = take2.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(1, it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(2, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
it = take3.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(1, it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
|
@ -92,9 +75,7 @@ main() {
|
|||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(3, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
it = take4.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(1, it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
|
@ -102,70 +83,53 @@ main() {
|
|||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(3, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
take0 = list2.take(0);
|
||||
it = take0.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
take1 = list2.take(1);
|
||||
it = take1.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(4, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
take2 = list2.take(2);
|
||||
it = take2.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(4, it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(5, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
take3 = list2.take(3);
|
||||
it = take3.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(4, it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(5, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
Iterable<String> take02 = list3.take(0);
|
||||
Iterator<String> it2 = take02.iterator;
|
||||
Expect.isNull(it2.current);
|
||||
Expect.isFalse(it2.moveNext());
|
||||
Expect.isNull(it2.current);
|
||||
|
||||
Iterable<String> take12 = list3.take(1);
|
||||
it2 = take12.iterator;
|
||||
Expect.isNull(it2.current);
|
||||
Expect.isFalse(it2.moveNext());
|
||||
Expect.isNull(it2.current);
|
||||
|
||||
take0 = set1.take(0);
|
||||
it = take0.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
take1 = set1.take(1);
|
||||
List<int> copied = take1.toList();
|
||||
Expect.equals(1, copied.length);
|
||||
Expect.isTrue(set1.contains(copied[0]));
|
||||
it = take1.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.isNotNull(it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
take2 = set1.take(2);
|
||||
copied = take2.toList();
|
||||
|
@ -174,13 +138,11 @@ main() {
|
|||
Expect.isTrue(set1.contains(copied[1]));
|
||||
Expect.isTrue(copied[0] != copied[1]);
|
||||
it = take2.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.isNotNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.isNotNull(it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
take3 = set1.take(3);
|
||||
copied = take3.toList();
|
||||
|
@ -192,7 +154,6 @@ main() {
|
|||
Expect.isTrue(copied[0] != copied[2]);
|
||||
Expect.isTrue(copied[1] != copied[2]);
|
||||
it = take3.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.isNotNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
|
@ -200,19 +161,14 @@ main() {
|
|||
Expect.isTrue(it.moveNext());
|
||||
Expect.isNotNull(it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
var dynamicTake0 = set2.take(0);
|
||||
var dynamicIt = dynamicTake0.iterator;
|
||||
Expect.isNull(dynamicIt.current);
|
||||
Expect.isFalse(dynamicIt.moveNext());
|
||||
Expect.isNull(dynamicIt.current);
|
||||
|
||||
var dynamicTake1 = set2.take(1);
|
||||
dynamicIt = dynamicTake1.iterator;
|
||||
Expect.isNull(dynamicIt.current);
|
||||
Expect.isFalse(dynamicIt.moveNext());
|
||||
Expect.isNull(dynamicIt.current);
|
||||
|
||||
Expect.throwsRangeError(() => list1.skip(-1));
|
||||
Expect.throwsRangeError(() => list2.skip(-1));
|
||||
|
|
|
@ -14,31 +14,24 @@ main() {
|
|||
|
||||
Iterable<int> takeWhileFalse = list1.takeWhile((x) => false);
|
||||
Iterator<int> it = takeWhileFalse.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
Iterable<int> takeWhileOdd = list1.takeWhile((x) => x.isOdd);
|
||||
it = takeWhileOdd.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(1, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
Iterable<int> takeWhileLessThan3 = list1.takeWhile((x) => x < 3);
|
||||
it = takeWhileLessThan3.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(1, it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(2, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
Iterable<int> takeEverything = list1.takeWhile((x) => true);
|
||||
it = takeEverything.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(1, it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
|
@ -46,55 +39,40 @@ main() {
|
|||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(3, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
Iterable<int> takeWhileEven = list1.takeWhile((x) => x.isEven);
|
||||
it = takeWhileFalse.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
takeWhileFalse = list2.takeWhile((x) => false);
|
||||
it = takeWhileFalse.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
takeWhileEven = list2.takeWhile((x) => x.isEven);
|
||||
it = takeWhileEven.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(4, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
takeEverything = list2.takeWhile((x) => true);
|
||||
it = takeEverything.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(4, it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.equals(5, it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
Iterable<String> takeWhileFalse2 = list3.takeWhile((x) => false);
|
||||
Iterator<String> it2 = takeWhileFalse2.iterator;
|
||||
Expect.isNull(it2.current);
|
||||
Expect.isFalse(it2.moveNext());
|
||||
Expect.isNull(it2.current);
|
||||
|
||||
Iterable<String> takeEverything2 = list3.takeWhile((x) => true);
|
||||
it2 = takeEverything2.iterator;
|
||||
Expect.isNull(it2.current);
|
||||
Expect.isFalse(it2.moveNext());
|
||||
Expect.isNull(it2.current);
|
||||
|
||||
takeWhileFalse = set1.takeWhile((x) => false);
|
||||
it = takeWhileFalse.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
takeEverything = set1.takeWhile((x) => true);
|
||||
List<int> copied = takeEverything.toList();
|
||||
|
@ -106,7 +84,6 @@ main() {
|
|||
Expect.isTrue(copied[0] != copied[2]);
|
||||
Expect.isTrue(copied[1] != copied[2]);
|
||||
it = takeEverything.iterator;
|
||||
Expect.isNull(it.current);
|
||||
Expect.isTrue(it.moveNext());
|
||||
Expect.isTrue(it.current != null);
|
||||
Expect.isTrue(it.moveNext());
|
||||
|
@ -114,17 +91,12 @@ main() {
|
|||
Expect.isTrue(it.moveNext());
|
||||
Expect.isTrue(it.current != null);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
var dynamicTakeWhileFalse = set2.takeWhile((x) => false);
|
||||
var dynamicIt = dynamicTakeWhileFalse.iterator;
|
||||
Expect.isNull(dynamicIt.current);
|
||||
Expect.isFalse(dynamicIt.moveNext());
|
||||
Expect.isNull(dynamicIt.current);
|
||||
|
||||
var dynamicTakeEverything = set2.takeWhile((x) => true);
|
||||
dynamicIt = dynamicTakeEverything.iterator;
|
||||
Expect.isNull(dynamicIt.current);
|
||||
Expect.isFalse(dynamicIt.moveNext());
|
||||
Expect.isNull(dynamicIt.current);
|
||||
}
|
||||
|
|
|
@ -7,14 +7,12 @@ import "package:expect/expect.dart";
|
|||
class ListIteratorsTest {
|
||||
static void checkListIterator(List a) {
|
||||
Iterator it = a.iterator;
|
||||
Expect.isNull(it.current);
|
||||
for (int i = 0; i < a.length; i++) {
|
||||
Expect.isTrue(it.moveNext());
|
||||
var elem = it.current;
|
||||
Expect.equals(a[i], elem);
|
||||
}
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
}
|
||||
|
||||
static testMain() {
|
||||
|
|
|
@ -31,7 +31,6 @@ class QueueIteratorTest {
|
|||
Iterator<int> it = queue.iterator;
|
||||
sum(6, it);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
}
|
||||
|
||||
static void testLargeQueue() {
|
||||
|
@ -44,7 +43,6 @@ class QueueIteratorTest {
|
|||
Iterator<int> it = queue.iterator;
|
||||
sum(count, it);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
}
|
||||
|
||||
static void testEmptyQueue() {
|
||||
|
@ -52,7 +50,6 @@ class QueueIteratorTest {
|
|||
Iterator<int> it = queue.iterator;
|
||||
sum(0, it);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,23 +6,23 @@
|
|||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
void assertEquals(actual, expected, [String message = null]) {
|
||||
void assertEquals(actual, expected, [String? message = null]) {
|
||||
Expect.equals(actual, expected, message);
|
||||
}
|
||||
|
||||
void assertTrue(actual, [String message = null]) {
|
||||
void assertTrue(actual, [String? message = null]) {
|
||||
Expect.isTrue(actual, message);
|
||||
}
|
||||
|
||||
void assertFalse(actual, [String message = null]) {
|
||||
void assertFalse(actual, [String? message = null]) {
|
||||
Expect.isFalse(actual, message);
|
||||
}
|
||||
|
||||
void assertThrows(fn, [num testid = null]) {
|
||||
void assertThrows(fn, [num? testid = null]) {
|
||||
Expect.throws(fn, null, "Test $testid");
|
||||
}
|
||||
|
||||
void assertDoesNotThrow(fn, [num testid = null]) {
|
||||
void assertDoesNotThrow(fn, [num? testid = null]) {
|
||||
fn();
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ void assertNull(actual, [num testid = null]) {
|
|||
Expect.isNull(actual, "Test $testid");
|
||||
}
|
||||
|
||||
void assertToStringEquals(str, match, num testid) {
|
||||
void assertToStringEquals(str, match, num? testid) {
|
||||
var actual = [];
|
||||
for (int i = 0; i <= match.groupCount; i++) {
|
||||
var g = match.group(i);
|
||||
|
@ -51,7 +51,7 @@ void shouldBeNull(actual) {
|
|||
Expect.isNull(actual);
|
||||
}
|
||||
|
||||
void shouldBe(actual, expected, [String message = null]) {
|
||||
void shouldBe(actual, expected, [String? message = null]) {
|
||||
if (expected == null) {
|
||||
Expect.isNull(actual, message);
|
||||
} else {
|
||||
|
|
|
@ -40,7 +40,6 @@ class SetIteratorTest {
|
|||
Iterator<int> it = set.iterator;
|
||||
sum(6, it);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
}
|
||||
|
||||
static void testLargeSet() {
|
||||
|
@ -53,7 +52,6 @@ class SetIteratorTest {
|
|||
Iterator<int> it = set.iterator;
|
||||
sum(count, it);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
}
|
||||
|
||||
static void testEmptySet() {
|
||||
|
@ -61,7 +59,6 @@ class SetIteratorTest {
|
|||
Iterator<int> it = set.iterator;
|
||||
sum(0, it);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
}
|
||||
|
||||
static void testSetWithDeletedEntries() {
|
||||
|
@ -77,7 +74,6 @@ class SetIteratorTest {
|
|||
it = set.iterator;
|
||||
sum(0, it);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
|
||||
int count = 0;
|
||||
for (int i = 0; i < 100; i++) {
|
||||
|
@ -90,7 +86,6 @@ class SetIteratorTest {
|
|||
it = set.iterator;
|
||||
sum(count, it);
|
||||
Expect.isFalse(it.moveNext());
|
||||
Expect.isNull(it.current);
|
||||
}
|
||||
|
||||
static void testBug5116829() {
|
||||
|
|
Loading…
Reference in a new issue