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

Unified Diff: tests/corelib/queue_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/queue_first_test.dart ('k') | tests/corelib/queue_last_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib/queue_iterator_test.dart
diff --git a/tests/corelib/queue_iterator_test.dart b/tests/corelib/queue_iterator_test.dart
index 4f9ffff019bd8dc3ed04403477fc4108154e7293..ca1d9ab7c673faabc6e38d61549b018d84c44273 100644
--- a/tests/corelib/queue_iterator_test.dart
+++ b/tests/corelib/queue_iterator_test.dart
@@ -9,21 +9,10 @@ class QueueIteratorTest {
testEmptyQueue();
}
- 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);
}
@@ -34,10 +23,10 @@ class QueueIteratorTest {
queue.addLast(2);
queue.addLast(3);
- Iterator<int> it = queue.iterator();
- Expect.equals(true, it.hasNext);
+ Iterator<int> it = queue.iterator;
sum(6, it);
- testThrows(it);
+ Expect.isFalse(it.moveNext());
+ Expect.isNull(it.current);
}
static void testLargeQueue() {
@@ -47,18 +36,18 @@ class QueueIteratorTest {
count += i;
queue.addLast(i);
}
- Iterator<int> it = queue.iterator();
- Expect.equals(true, it.hasNext);
+ Iterator<int> it = queue.iterator;
sum(count, it);
- testThrows(it);
+ Expect.isFalse(it.moveNext());
+ Expect.isNull(it.current);
}
static void testEmptyQueue() {
Queue<int> queue = new Queue<int>();
- Iterator<int> it = queue.iterator();
- Expect.equals(false, it.hasNext);
+ Iterator<int> it = queue.iterator;
sum(0, it);
- testThrows(it);
+ Expect.isFalse(it.moveNext());
+ Expect.isNull(it.current);
}
}
« no previous file with comments | « tests/corelib/queue_first_test.dart ('k') | tests/corelib/queue_last_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698