| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /** |
| 5 * The mirror matchers library provides some additional matchers that | 6 * The mirror matchers library provides some additional matchers that |
| 6 * make use of dart:mirrors. | 7 * make use of `dart:mirrors`. |
| 7 * | |
| 8 * ## Installing ## | |
| 9 * | |
| 10 * Use [pub][] to install this package. Add the following to your `pubspec.yaml` | |
| 11 * file. | |
| 12 * | |
| 13 * dependencies: | |
| 14 * unittest: any | |
| 15 * | |
| 16 * Then run `pub install`. | |
| 17 * | |
| 18 * Import this into your Dart code with: | |
| 19 * | |
| 20 * import 'package:unittest/mirror_matchers.dart'; | |
| 21 * | |
| 22 * For more information, see the [unittest package on pub.dartlang.org]. | |
| 23 * (http://pub.dartlang.org/packages/unittest). | |
| 24 * | |
| 25 * [pub]: http://pub.dartlang.org | |
| 26 * [pkg]: http://pub.dartlang.org/packages/mirror_matchers | |
| 27 */ | 8 */ |
| 28 library unittest.mirror_matchers; | 9 library matcher.mirror_matchers; |
| 29 | 10 |
| 30 import 'dart:mirrors'; | 11 import 'dart:mirrors'; |
| 31 | 12 |
| 32 import 'matcher.dart'; | 13 import 'matcher.dart'; |
| 33 | 14 |
| 34 /** | 15 /** |
| 35 * Returns a matcher that checks if a class instance has a property | 16 * Returns a matcher that checks if a class instance has a property |
| 36 * with name [name], and optionally, if that property in turn satisfies | 17 * with name [name], and optionally, if that property in turn satisfies |
| 37 * a [matcher]. | 18 * a [matcher]. |
| 38 */ | 19 */ |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 var innerDescription = new StringDescription(); | 71 var innerDescription = new StringDescription(); |
| 91 _matcher.describeMismatch(matchState['value'], innerDescription, | 72 _matcher.describeMismatch(matchState['value'], innerDescription, |
| 92 matchState['state'], verbose); | 73 matchState['state'], verbose); |
| 93 if (innerDescription.length > 0) { | 74 if (innerDescription.length > 0) { |
| 94 mismatchDescription.add(' which ').add(innerDescription.toString()); | 75 mismatchDescription.add(' which ').add(innerDescription.toString()); |
| 95 } | 76 } |
| 96 } | 77 } |
| 97 return mismatchDescription; | 78 return mismatchDescription; |
| 98 } | 79 } |
| 99 } | 80 } |
| OLD | NEW |