| Index: tests/corelib/set_iterator_test.dart
|
| diff --git a/tests/corelib/set_iterator_test.dart b/tests/corelib/set_iterator_test.dart
|
| index 08135e4110f599e27802577135979d3dc46a8237..d6ec16e29527e30ce10caf3486b08dc963e41c2c 100644
|
| --- a/tests/corelib/set_iterator_test.dart
|
| +++ b/tests/corelib/set_iterator_test.dart
|
| @@ -19,21 +19,10 @@ class SetIteratorTest {
|
| testDifferentHashCodes();
|
| }
|
|
|
| - static void testThrows(Iterator<int> it) {
|
| - Expect.equals(false, it.hasNext);
|
| - var exception = null;
|
| - try {
|
| - it.next();
|
| - } on StateError catch (e) {
|
| - exception = e;
|
| - }
|
| - Expect.equals(true, exception != null);
|
| - }
|
| -
|
| static int sum(int expected, Iterator<int> it) {
|
| int count = 0;
|
| - while (it.hasNext) {
|
| - count += it.next();
|
| + while (it.moveNext()) {
|
| + count += it.current;
|
| }
|
| Expect.equals(expected, count);
|
| }
|
| @@ -44,10 +33,10 @@ class SetIteratorTest {
|
| set.add(2);
|
| set.add(3);
|
|
|
| - Iterator<int> it = set.iterator();
|
| - Expect.equals(true, it.hasNext);
|
| + Iterator<int> it = set.iterator;
|
| sum(6, it);
|
| - testThrows(it);
|
| + Expect.isFalse(it.moveNext());
|
| + Expect.isNull(it.current);
|
| }
|
|
|
| static void testLargeSet() {
|
| @@ -57,18 +46,18 @@ class SetIteratorTest {
|
| count += i;
|
| set.add(i);
|
| }
|
| - Iterator<int> it = set.iterator();
|
| - Expect.equals(true, it.hasNext);
|
| + Iterator<int> it = set.iterator;
|
| sum(count, it);
|
| - testThrows(it);
|
| + Expect.isFalse(it.moveNext());
|
| + Expect.isNull(it.current);
|
| }
|
|
|
| static void testEmptySet() {
|
| Set<int> set = new Set<int>();
|
| - Iterator<int> it = set.iterator();
|
| - Expect.equals(false, it.hasNext);
|
| + Iterator<int> it = set.iterator;
|
| sum(0, it);
|
| - testThrows(it);
|
| + Expect.isFalse(it.moveNext());
|
| + Expect.isNull(it.current);
|
| }
|
|
|
| static void testSetWithDeletedEntries() {
|
| @@ -79,10 +68,12 @@ class SetIteratorTest {
|
| for (int i = 0; i < 100; i++) {
|
| set.remove(i);
|
| }
|
| - Iterator<int> it = set.iterator();
|
| - Expect.equals(false, it.hasNext);
|
| + Iterator<int> it = set.iterator;
|
| + Expect.isFalse(it.moveNext());
|
| + it = set.iterator;
|
| sum(0, it);
|
| - testThrows(it);
|
| + Expect.isFalse(it.moveNext());
|
| + Expect.isNull(it.current);
|
|
|
| int count = 0;
|
| for (int i = 0; i < 100; i++) {
|
| @@ -90,10 +81,10 @@ class SetIteratorTest {
|
| if (i % 2 == 0) set.remove(i);
|
| else count += i;
|
| }
|
| - it = set.iterator();
|
| - Expect.equals(true, it.hasNext);
|
| + it = set.iterator;
|
| sum(count, it);
|
| - testThrows(it);
|
| + Expect.isFalse(it.moveNext());
|
| + Expect.isNull(it.current);
|
| }
|
|
|
| static void testBug5116829() {
|
|
|