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

Unified Diff: pkg/unittest/lib/src/core_matchers.dart

Issue 12193016: Added an example of the use of predicate. (Closed) Base URL: http://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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/unittest/lib/src/core_matchers.dart
===================================================================
--- pkg/unittest/lib/src/core_matchers.dart (revision 18082)
+++ pkg/unittest/lib/src/core_matchers.dart (working copy)
@@ -632,14 +632,16 @@
/**
* Returns a matcher that uses an arbitrary function that returns
- * true or false for the actual value.
+ * true or false for the actual value. For example:
+ *
+ * expect(v, predicate((x) => ((x % 2) == 0), "is even"))
*/
-Matcher predicate(f, [description ='satisfies function']) =>
+Matcher predicate(Function f, [description ='satisfies function']) =>
new _Predicate(f, description);
class _Predicate extends BaseMatcher {
- final _matcher;
+ final Function _matcher;
final String _description;
const _Predicate(this._matcher, this._description);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698