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

Side by Side Diff: pkg/matcher/lib/src/future_matchers.dart

Issue 313563002: pkg/matcher: Reverting 36881,36896 while investigating dart2js checked crash (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/matcher/lib/src/expect.dart ('k') | pkg/matcher/lib/src/interfaces.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library matcher.future_matchers; 5 part of matcher;
6 6
7 import 'dart:async'; 7 /**
8 8 * Matches a [Future] that completes successfully with a value. Note that this
9 import 'core_matchers.dart'; 9 * creates an asynchronous expectation. The call to `expect()` that includes
10 import 'expect.dart'; 10 * this will return immediately and execution will continue. Later, when the
11 import 'interfaces.dart'; 11 * future completes, the actual expectation will run.
12 12 *
13 /// Matches a [Future] that completes successfully with a value. Note that this 13 * To test that a Future completes with an exception, you can use [throws] and
14 /// creates an asynchronous expectation. The call to `expect()` that includes 14 * [throwsA].
15 /// this will return immediately and execution will continue. Later, when the 15 */
16 /// future completes, the actual expectation will run.
17 ///
18 /// To test that a Future completes with an exception, you can use [throws] and
19 /// [throwsA].
20 final Matcher completes = const _Completes(null, ''); 16 final Matcher completes = const _Completes(null, '');
21 17
22 /// Matches a [Future] that completes succesfully with a value that matches 18 /**
23 /// [matcher]. Note that this creates an asynchronous expectation. The call to 19 * Matches a [Future] that completes succesfully with a value that matches
24 /// `expect()` that includes this will return immediately and execution will 20 * [matcher]. Note that this creates an asynchronous expectation. The call to
25 /// continue. Later, when the future completes, the actual expectation will run. 21 * `expect()` that includes this will return immediately and execution will
26 /// 22 * continue. Later, when the future completes, the actual expectation will run.
27 /// To test that a Future completes with an exception, you can use [throws] and 23 *
28 /// [throwsA]. 24 * To test that a Future completes with an exception, you can use [throws] and
29 /// 25 * [throwsA].
30 /// [id] is an optional tag that can be used to identify the completion matcher 26 *
31 /// in error messages. 27 * [id] is an optional tag that can be used to identify the completion matcher
28 * in error messages.
29 */
32 Matcher completion(matcher, [String id = '']) => 30 Matcher completion(matcher, [String id = '']) =>
33 new _Completes(wrapMatcher(matcher), id); 31 new _Completes(wrapMatcher(matcher), id);
34 32
35 class _Completes extends Matcher { 33 class _Completes extends Matcher {
36 final Matcher _matcher; 34 final Matcher _matcher;
37 final String _id; 35 final String _id;
38 36
39 const _Completes(this._matcher, this._id); 37 const _Completes(this._matcher, this._id);
40 38
41 bool matches(item, Map matchState) { 39 bool matches(item, Map matchState) {
(...skipping 19 matching lines...) Expand all
61 59
62 Description describe(Description description) { 60 Description describe(Description description) {
63 if (_matcher == null) { 61 if (_matcher == null) {
64 description.add('completes successfully'); 62 description.add('completes successfully');
65 } else { 63 } else {
66 description.add('completes to a value that ').addDescriptionOf(_matcher); 64 description.add('completes to a value that ').addDescriptionOf(_matcher);
67 } 65 }
68 return description; 66 return description;
69 } 67 }
70 } 68 }
OLDNEW
« no previous file with comments | « pkg/matcher/lib/src/expect.dart ('k') | pkg/matcher/lib/src/interfaces.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698