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