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

Side by Side Diff: pkg/matcher/test/iterable_matchers_test.dart

Issue 763783003: Add isNotEmpty to core_matchers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Style fixes Created 6 years 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/test/core_matchers_test.dart ('k') | pkg/matcher/test/matchers_minified_test.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.iterable_matchers_test; 5 library matcher.iterable_matchers_test;
6 6
7 import 'package:matcher/matcher.dart'; 7 import 'package:matcher/matcher.dart';
8 import 'package:unittest/unittest.dart' show test, group; 8 import 'package:unittest/unittest.dart' show test, group;
9 9
10 import 'test_utils.dart'; 10 import 'test_utils.dart';
11 11
12 void main() { 12 void main() {
13 initUtils(); 13 initUtils();
14 14
15 test('isEmpty', () { 15 test('isEmpty', () {
16 shouldPass([], isEmpty); 16 shouldPass([], isEmpty);
17 shouldFail([1], isEmpty, "Expected: empty Actual: [1]"); 17 shouldFail([1], isEmpty, "Expected: empty Actual: [1]");
18 }); 18 });
19 19
20 test('isNotEmpty', () {
21 shouldFail([], isNotEmpty, "Expected: non-empty Actual: []");
22 shouldPass([1], isNotEmpty);
23 });
24
20 test('contains', () { 25 test('contains', () {
21 var d = [1, 2]; 26 var d = [1, 2];
22 shouldPass(d, contains(1)); 27 shouldPass(d, contains(1));
23 shouldFail(d, contains(0), "Expected: contains <0> " 28 shouldFail(d, contains(0), "Expected: contains <0> "
24 "Actual: [1, 2]"); 29 "Actual: [1, 2]");
25 }); 30 });
26 31
27 test('equals with matcher element', () { 32 test('equals with matcher element', () {
28 var d = ['foo', 'bar']; 33 var d = ['foo', 'bar'];
29 shouldPass(d, equals(['foo', startsWith('ba')])); 34 shouldPass(d, equals(['foo', startsWith('ba')]));
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 "Expected: pairwise less than [1, 4, 9] " 162 "Expected: pairwise less than [1, 4, 9] "
158 "Actual: [1, 2, 3] " 163 "Actual: [1, 2, 3] "
159 "Which: has <1> which is not less than <1> at index 0"); 164 "Which: has <1> which is not less than <1> at index 0");
160 shouldPass(d, pairwiseCompare(e, (e,a) => a * a == e, "square root of")); 165 shouldPass(d, pairwiseCompare(e, (e,a) => a * a == e, "square root of"));
161 shouldFail(d, pairwiseCompare(e, (e,a) => a + a == e, "double"), 166 shouldFail(d, pairwiseCompare(e, (e,a) => a + a == e, "double"),
162 "Expected: pairwise double [1, 4, 9] " 167 "Expected: pairwise double [1, 4, 9] "
163 "Actual: [1, 2, 3] " 168 "Actual: [1, 2, 3] "
164 "Which: has <1> which is not double <1> at index 0"); 169 "Which: has <1> which is not double <1> at index 0");
165 }); 170 });
166 } 171 }
OLDNEW
« no previous file with comments | « pkg/matcher/test/core_matchers_test.dart ('k') | pkg/matcher/test/matchers_minified_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698