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

Unified Diff: tests/lib/async/future_test.dart

Issue 12324004: Add test for whether a completer or stream controller has been closed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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
Index: tests/lib/async/future_test.dart
diff --git a/tests/lib/async/future_test.dart b/tests/lib/async/future_test.dart
index 43f083a2a4f7fe17f14190ab7a429c3abbb3679d..87e669e5d401488313fdecdfa26764342dd9ea6f 100644
--- a/tests/lib/async/future_test.dart
+++ b/tests/lib/async/future_test.dart
@@ -53,8 +53,10 @@ testNeverComplete() {
testComplete() {
final completer = new Completer<int>();
final future = completer.future;
+ Expect.isFalse(completer.completed);
completer.complete(3);
+ Expect.isTrue(completer.completed);
future.then((v) => Expect.equals(3, v));
}
@@ -68,7 +70,10 @@ testCompleteWithSuccessHandlerBeforeComplete() {
int value;
future.then((int v) { value = v; });
Expect.isNull(value);
+
+ Expect.isFalse(completer.completed);
completer.complete(3);
+ Expect.isTrue(completer.completed);
Expect.equals(3, value);
}
@@ -135,7 +140,10 @@ testExceptionHandler() {
var ex2;
var done = future.catchError((e) { ex2 = e.error; });
+
+ Expect.isFalse(completer.completed);
completer.completeError(ex);
+ Expect.isTrue(completer.completed);
var port = new ReceivePort();
done.then((_) {
@@ -153,7 +161,9 @@ testExceptionHandlerReturnsTrue() {
future.catchError((e) { });
future.catchError((e) { reached = true; }, test: (e) => false)
.catchError((e) {});
+ Expect.isFalse(completer.completed);
completer.completeError(ex);
+ Expect.isTrue(completer.completed);
Expect.isFalse(reached);
}

Powered by Google App Engine
This is Rietveld 408576698