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

Unified Diff: pkg/matcher/test/operator_matchers_test.dart

Issue 438473002: pkg/matcher: refactored code around data-structure vs execution-based matchers (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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/matcher/test/core_matchers_test.dart ('k') | pkg/matcher/test/throws_matchers_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/matcher/test/operator_matchers_test.dart
diff --git a/pkg/matcher/test/operator_matchers_test.dart b/pkg/matcher/test/operator_matchers_test.dart
index fd9627a71a5afcc13f395cdd93613fd96c3e15f1..f82abaa2a46b7103a7400b3eac55b32efe315a0e 100644
--- a/pkg/matcher/test/operator_matchers_test.dart
+++ b/pkg/matcher/test/operator_matchers_test.dart
@@ -13,16 +13,47 @@ void main() {
initUtils();
test('anyOf', () {
+ // with a list
shouldFail(0, anyOf([equals(1), equals(2)]),
"Expected: (<1> or <2>) Actual: <0>");
shouldPass(1, anyOf([equals(1), equals(2)]));
+
+ // with individual items
+ shouldFail(0, anyOf(equals(1), equals(2)),
+ "Expected: (<1> or <2>) Actual: <0>");
+ shouldPass(1, anyOf(equals(1), equals(2)));
});
test('allOf', () {
+ // with a list
shouldPass(1, allOf([lessThan(10), greaterThan(0)]));
shouldFail(-1, allOf([lessThan(10), greaterThan(0)]),
"Expected: (a value less than <10> and a value greater than <0>) "
"Actual: <-1> "
"Which: is not a value greater than <0>");
+
+ // with individual items
+ shouldPass(1, allOf(lessThan(10), greaterThan(0)));
+ shouldFail(-1, allOf(lessThan(10), greaterThan(0)),
+ "Expected: (a value less than <10> and a value greater than <0>) "
+ "Actual: <-1> "
+ "Which: is not a value greater than <0>");
+
+ // with maximum items
+ shouldPass(1, allOf(lessThan(10), lessThan(9), lessThan(8), lessThan(7),
+ lessThan(6), lessThan(5), lessThan(4)));
+ shouldFail(4, allOf(lessThan(10), lessThan(9), lessThan(8), lessThan(7),
+ lessThan(6), lessThan(5), lessThan(4)),
+ "Expected: (a value less than <10> and a value less than <9> and a "
+ "value less than <8> and a value less than <7> and a value less than "
+ "<6> and a value less than <5> and a value less than <4>) "
+ "Actual: <4> "
+ "Which: is not a value less than <4>");
+ });
+
+ test('If the first argument is a List, the rest must be null', () {
+ expect(() => allOf([], 5), throwsArgumentError);
+ expect(() => anyOf([], null, null, null, null, null, 42),
+ throwsArgumentError);
});
}
« no previous file with comments | « pkg/matcher/test/core_matchers_test.dart ('k') | pkg/matcher/test/throws_matchers_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698