Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1047)

Unified Diff: tests/corelib/set_iterator_test.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/corelib/reg_exp_start_end_test.dart ('k') | tests/corelib/set_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « tests/corelib/reg_exp_start_end_test.dart ('k') | tests/corelib/set_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698