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

Unified Diff: pkg/unittest/future_matchers.dart

Issue 10917275: Update unittest to new package layout. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 | « pkg/unittest/expect.dart ('k') | pkg/unittest/html_config.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/unittest/future_matchers.dart
diff --git a/pkg/unittest/future_matchers.dart b/pkg/unittest/future_matchers.dart
deleted file mode 100644
index bb3a3c019453da1a5a65d94a3fa398e817409309..0000000000000000000000000000000000000000
--- a/pkg/unittest/future_matchers.dart
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/**
- * Matches a [Future] that completes successfully with a value. Note that this
- * creates an asynchronous expectation. The call to `expect()` that includes
- * this will return immediately and execution will continue. Later, when the
- * future completes, the actual expectation will run.
- *
- * To test that a Future completes with an exception, you can use [throws] and
- * [throwsA].
- */
-Matcher completes = const _Completes(null);
-
-/**
- * Matches a [Future] that completes succesfully with a value that matches
- * [matcher]. Note that this creates an asynchronous expectation. The call to
- * `expect()` that includes this will return immediately and execution will
- * continue. Later, when the future completes, the actual expectation will run.
- *
- * To test that a Future completes with an exception, you can use [throws] and
- * [throwsA].
- */
-Matcher completion(matcher) => new _Completes(wrapMatcher(matcher));
-
-class _Completes extends BaseMatcher {
- final Matcher _matcher;
-
- const _Completes(this._matcher);
-
- bool matches(item, MatchState matchState) {
- if (item is! Future) return false;
-
- item.onComplete(expectAsync1((future) {
- var reason = 'Expected future to complete successfully, but it failed '
- 'with ${future.exception}';
- if (future.stackTrace != null) {
- var stackTrace = future.stackTrace.toString();
- stackTrace = ' ${stackTrace.replaceAll('\n', '\n ')}';
- reason = '$reason\nStack trace:\n$stackTrace';
- }
-
- expect(future.hasValue, reason: reason);
- if (_matcher != null) expect(future.value, _matcher);
- }));
-
- return true;
- }
-
- Description describe(Description description) {
- if (_matcher == null) {
- description.add('completes successfully');
- } else {
- description.add('completes to a value that ').addDescriptionOf(_matcher);
- }
- return description;
- }
-}
« no previous file with comments | « pkg/unittest/expect.dart ('k') | pkg/unittest/html_config.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698