| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | |
| 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. | |
| 4 | |
| 5 // This file is for matcher tests that rely on the names of various Dart types. | |
| 6 // These tests will fail when run in minified dart2js, since the names will be | |
| 7 // mangled. A version of this file that works in minified dart2js is in | |
| 8 // matchers_minified_test.dart. | |
| 9 | |
| 10 import 'package:matcher/matcher.dart'; | |
| 11 import 'package:unittest/unittest.dart'; | |
| 12 | |
| 13 import 'test_utils.dart'; | |
| 14 | |
| 15 void main() { | |
| 16 group('Iterable Matchers', () { | |
| 17 test('isEmpty', () { | |
| 18 var d = new SimpleIterable(0); | |
| 19 var e = new SimpleIterable(1); | |
| 20 shouldPass(d, isEmpty); | |
| 21 shouldFail(e, isEmpty, "Expected: empty " | |
| 22 "Actual: SimpleIterable:[1]"); | |
| 23 }); | |
| 24 | |
| 25 test('isNotEmpty', () { | |
| 26 var d = new SimpleIterable(0); | |
| 27 var e = new SimpleIterable(1); | |
| 28 shouldPass(e, isNotEmpty); | |
| 29 shouldFail(d, isNotEmpty, "Expected: non-empty " | |
| 30 "Actual: SimpleIterable:[]"); | |
| 31 }); | |
| 32 | |
| 33 test('contains', () { | |
| 34 var d = new SimpleIterable(3); | |
| 35 shouldPass(d, contains(2)); | |
| 36 shouldFail(d, contains(5), "Expected: contains <5> " | |
| 37 "Actual: SimpleIterable:[3, 2, 1]"); | |
| 38 }); | |
| 39 }); | |
| 40 | |
| 41 group('Feature Matchers', () { | |
| 42 test("Feature Matcher", () { | |
| 43 var w = new Widget(); | |
| 44 w.price = 10; | |
| 45 shouldPass(w, new HasPrice(10)); | |
| 46 shouldPass(w, new HasPrice(greaterThan(0))); | |
| 47 shouldFail(w, new HasPrice(greaterThan(10)), | |
| 48 "Expected: Widget with a price that is a value greater than <10> " | |
| 49 "Actual: <Instance of 'Widget'> " | |
| 50 "Which: has price with value <10> which is not " | |
| 51 "a value greater than <10>"); | |
| 52 }); | |
| 53 }); | |
| 54 } | |
| OLD | NEW |