Chromium Code Reviews| 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 | |
|
kevmoo
2015/02/18 04:11:08
need to import 'test_utils.dart'
nweiz
2015/02/19 00:31:08
Done.
| |
| 13 void main() { | |
| 14 group('Iterable Matchers', () { | |
| 15 test('isEmpty', () { | |
| 16 var d = new SimpleIterable(0); | |
| 17 var e = new SimpleIterable(1); | |
| 18 shouldPass(d, isEmpty); | |
| 19 shouldFail(e, isEmpty, "Expected: empty " | |
| 20 "Actual: SimpleIterable:[1]"); | |
| 21 }); | |
| 22 | |
| 23 test('isNotEmpty', () { | |
| 24 var d = new SimpleIterable(0); | |
| 25 var e = new SimpleIterable(1); | |
| 26 shouldPass(e, isNotEmpty); | |
| 27 shouldFail(d, isNotEmpty, "Expected: non-empty " | |
| 28 "Actual: SimpleIterable:[]"); | |
| 29 }); | |
| 30 | |
| 31 test('contains', () { | |
| 32 var d = new SimpleIterable(3); | |
| 33 shouldPass(d, contains(2)); | |
| 34 shouldFail(d, contains(5), "Expected: contains <5> " | |
| 35 "Actual: SimpleIterable:[3, 2, 1]"); | |
| 36 }); | |
| 37 }); | |
| 38 | |
| 39 group('Feature Matchers', () { | |
| 40 test("Feature Matcher", () { | |
| 41 var w = new Widget(); | |
| 42 w.price = 10; | |
| 43 shouldPass(w, new HasPrice(10)); | |
| 44 shouldPass(w, new HasPrice(greaterThan(0))); | |
| 45 shouldFail(w, new HasPrice(greaterThan(10)), | |
| 46 "Expected: Widget with a price that is a value greater than <10> " | |
| 47 "Actual: <Instance of 'Widget'> " | |
| 48 "Which: has price with value <10> which is not " | |
| 49 "a value greater than <10>"); | |
| 50 }); | |
| 51 }); | |
| 52 } | |
| OLD | NEW |