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

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

Issue 629113002: Adjusting matcher comments with one-line summaries (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merging master Created 6 years, 2 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/string_matchers.dart ('k') | no next file » | 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.util; 5 library matcher.util;
6 6
7 import 'core_matchers.dart'; 7 import 'core_matchers.dart';
8 import 'interfaces.dart'; 8 import 'interfaces.dart';
9 9
10 /// Useful utility for nesting match states. 10 /// Useful utility for nesting match states.
11 void addStateInfo(Map matchState, Map values) { 11 void addStateInfo(Map matchState, Map values) {
12 var innerState = new Map.from(matchState); 12 var innerState = new Map.from(matchState);
13 matchState.clear(); 13 matchState.clear();
14 matchState['state'] = innerState; 14 matchState['state'] = innerState;
15 matchState.addAll(values); 15 matchState.addAll(values);
16 } 16 }
17 17
18 /// Takes an argument and returns an equivalent matcher. 18 /// Takes an argument and returns an equivalent [Matcher].
19 ///
19 /// If the argument is already a matcher this does nothing, 20 /// If the argument is already a matcher this does nothing,
20 /// else if the argument is a function, it generates a predicate 21 /// else if the argument is a function, it generates a predicate
21 /// function matcher, else it generates an equals matcher. 22 /// function matcher, else it generates an equals matcher.
22 Matcher wrapMatcher(x) { 23 Matcher wrapMatcher(x) {
23 if (x is Matcher) { 24 if (x is Matcher) {
24 return x; 25 return x;
25 } else if (x is Function) { 26 } else if (x is Function) {
26 return predicate(x); 27 return predicate(x);
27 } else { 28 } else {
28 return equals(x); 29 return equals(x);
29 } 30 }
30 } 31 }
OLDNEW
« no previous file with comments | « pkg/matcher/lib/src/string_matchers.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698