Index: test/server/utils.dart |
diff --git a/test/server/utils.dart b/test/server/utils.dart |
index a4fd36af674b69f1e73a6091f2aad1505770cb96..75dc9b247a0f7363c27c50c39a54380b6b31407f 100644 |
--- a/test/server/utils.dart |
+++ b/test/server/utils.dart |
@@ -61,6 +61,20 @@ void expectErrorResponse(ServerController controller, request, int errorCode, |
}))); |
} |
+/// Returns a matcher that matches [Future]s that never complete. |
+Matcher get doesNotComplete => predicate((future) { |
+ future.then(expectAsync((_) { |
+ // This will never be called. [expectAsync] with `count: 0` ensures that an |
+ // error will be thrown when [future] completes. |
+ }, count: 0)); |
+ |
+ // Make sure there's enough time in the test for [expectAsync] to fail if it's |
+ // going to. |
+ expect(pumpEventQueue(), completes); |
+ |
+ return true; |
+}); |
+ |
/// Returns a matcher that matches a [json_rpc.RpcException] with an |
/// `invalid_params` error code. |
Matcher throwsInvalidParams(String message) { |