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 /** | 5 /** |
6 * A library for writing dart unit tests. | 6 * A library for writing dart unit tests. |
7 * | 7 * |
8 * To import this library, install the | 8 * ## Installing ## |
9 * [unittest package](http://pub.dartlang.org/packages/unittest) via the pub | 9 * |
10 * package manager. See the [Getting Started](http://pub.dartlang.org/doc) | 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 * For more information, see the |
| 19 * [unittest package on pub.dartlang.org][pkg]. |
| 20 * |
| 21 * See the [Getting Started](http://pub.dartlang.org/doc) |
11 * guide for more details. | 22 * guide for more details. |
12 * | 23 * |
13 * ##Concepts## | 24 * ##Concepts## |
14 * | 25 * |
15 * * __Tests__: Tests are specified via the top-level function [test], they can
be | 26 * * __Tests__: Tests are specified via the top-level function [test], they can
be |
16 * organized together using [group]. | 27 * organized together using [group]. |
17 * * __Checks__: Test expectations can be specified via [expect] | 28 * * __Checks__: Test expectations can be specified via [expect] |
18 * * __Matchers__: [expect] assertions are written declaratively using the | 29 * * __Matchers__: [expect] assertions are written declaratively using the |
19 * [Matcher] class. | 30 * [Matcher] class. |
20 * * __Configuration__: The framework can be adapted by calling [configure] wit
h a | 31 * * __Configuration__: The framework can be adapted by calling [configure] wit
h a |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 * guardAsync(() { | 154 * guardAsync(() { |
144 * int x = 2 + 3; | 155 * int x = 2 + 3; |
145 * expect(x, equals(5)); | 156 * expect(x, equals(5)); |
146 * }); | 157 * }); |
147 * // indicate that the asynchronous callback was invoked. | 158 * // indicate that the asynchronous callback was invoked. |
148 * async.complete(); | 159 * async.complete(); |
149 * }); | 160 * }); |
150 * }); | 161 * }); |
151 * } | 162 * } |
152 * | 163 * |
| 164 * [pub]: http://pub.dartlang.org |
| 165 * [pkg]: http://pub.dartlang.org/packages/unittest |
153 */ | 166 */ |
154 library unittest; | 167 library unittest; |
155 | 168 |
156 import 'dart:async'; | 169 import 'dart:async'; |
157 import 'dart:isolate'; | 170 import 'dart:isolate'; |
158 import 'dart:collection'; | 171 import 'dart:collection'; |
159 import 'matcher.dart'; | 172 import 'matcher.dart'; |
160 export 'matcher.dart'; | 173 export 'matcher.dart'; |
161 | 174 |
162 // TODO(amouravski): We should not need to import mock here, but it's necessary | 175 // TODO(amouravski): We should not need to import mock here, but it's necessary |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 } | 868 } |
856 | 869 |
857 /** Enable a test by ID. */ | 870 /** Enable a test by ID. */ |
858 void enableTest(int testId) => _setTestEnabledState(testId, true); | 871 void enableTest(int testId) => _setTestEnabledState(testId, true); |
859 | 872 |
860 /** Disable a test by ID. */ | 873 /** Disable a test by ID. */ |
861 void disableTest(int testId) => _setTestEnabledState(testId, false); | 874 void disableTest(int testId) => _setTestEnabledState(testId, false); |
862 | 875 |
863 /** Signature for a test function. */ | 876 /** Signature for a test function. */ |
864 typedef dynamic TestFunction(); | 877 typedef dynamic TestFunction(); |
OLD | NEW |