OLD | NEW |
---|---|
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.operator_matchers_test; | 5 library matcher.operator_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' |
9 show test, group, expect, throwsArgumentError; | |
nweiz
2015/02/17 23:17:42
Don't use "show" unless we absolutely have to.
kevmoo
2015/02/18 00:33:40
This is very explicit. Since unittest exports matc
nweiz
2015/02/18 00:42:07
There's no distinction between the test getting so
kevmoo
2015/02/18 00:49:50
To put it another way: unittest could change what
| |
9 | 10 |
10 import 'test_utils.dart'; | 11 import 'test_utils.dart'; |
11 | 12 |
12 void main() { | 13 void main() { |
13 initUtils(); | |
14 | |
15 test('anyOf', () { | 14 test('anyOf', () { |
16 // with a list | 15 // with a list |
17 shouldFail( | 16 shouldFail( |
18 0, anyOf([equals(1), equals(2)]), "Expected: (<1> or <2>) Actual: <0>"); | 17 0, anyOf([equals(1), equals(2)]), "Expected: (<1> or <2>) Actual: <0>"); |
19 shouldPass(1, anyOf([equals(1), equals(2)])); | 18 shouldPass(1, anyOf([equals(1), equals(2)])); |
20 | 19 |
21 // with individual items | 20 // with individual items |
22 shouldFail( | 21 shouldFail( |
23 0, anyOf(equals(1), equals(2)), "Expected: (<1> or <2>) Actual: <0>"); | 22 0, anyOf(equals(1), equals(2)), "Expected: (<1> or <2>) Actual: <0>"); |
24 shouldPass(1, anyOf(equals(1), equals(2))); | 23 shouldPass(1, anyOf(equals(1), equals(2))); |
(...skipping 25 matching lines...) Expand all Loading... | |
50 "Actual: <4> " | 49 "Actual: <4> " |
51 "Which: is not a value less than <4>"); | 50 "Which: is not a value less than <4>"); |
52 }); | 51 }); |
53 | 52 |
54 test('If the first argument is a List, the rest must be null', () { | 53 test('If the first argument is a List, the rest must be null', () { |
55 expect(() => allOf([], 5), throwsArgumentError); | 54 expect(() => allOf([], 5), throwsArgumentError); |
56 expect( | 55 expect( |
57 () => anyOf([], null, null, null, null, null, 42), throwsArgumentError); | 56 () => anyOf([], null, null, null, null, null, 42), throwsArgumentError); |
58 }); | 57 }); |
59 } | 58 } |
OLD | NEW |