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` |
Andrei Mouravski
2013/04/19 20:13:35
Actually, it might be good to say "the pub package
sethladd
2013/04/19 20:32:43
I added clarification for every file.
| |
11 * file. | |
12 * | |
13 * dependencies: | |
14 * unittest: any | |
15 * | |
16 * And then run `pub install`. | |
17 * | |
18 * See the [Getting Started](http://pub.dartlang.org/doc) | |
11 * guide for more details. | 19 * guide for more details. |
12 * | 20 * |
13 * ##Concepts## | 21 * ##Concepts## |
14 * | 22 * |
15 * * __Tests__: Tests are specified via the top-level function [test], they can be | 23 * * __Tests__: Tests are specified via the top-level function [test], they can be |
16 * organized together using [group]. | 24 * organized together using [group]. |
17 * * __Checks__: Test expectations can be specified via [expect] | 25 * * __Checks__: Test expectations can be specified via [expect] |
18 * * __Matchers__: [expect] assertions are written declaratively using the | 26 * * __Matchers__: [expect] assertions are written declaratively using the |
19 * [Matcher] class. | 27 * [Matcher] class. |
20 * * __Configuration__: The framework can be adapted by calling [configure] wit h a | 28 * * __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(() { | 151 * guardAsync(() { |
144 * int x = 2 + 3; | 152 * int x = 2 + 3; |
145 * expect(x, equals(5)); | 153 * expect(x, equals(5)); |
146 * }); | 154 * }); |
147 * // indicate that the asynchronous callback was invoked. | 155 * // indicate that the asynchronous callback was invoked. |
148 * async.complete(); | 156 * async.complete(); |
149 * }); | 157 * }); |
150 * }); | 158 * }); |
151 * } | 159 * } |
152 * | 160 * |
161 * [pub]: http://pub.dartlang.org | |
153 */ | 162 */ |
154 library unittest; | 163 library unittest; |
155 | 164 |
156 import 'dart:async'; | 165 import 'dart:async'; |
157 import 'dart:isolate'; | 166 import 'dart:isolate'; |
158 import 'dart:collection'; | 167 import 'dart:collection'; |
159 import 'matcher.dart'; | 168 import 'matcher.dart'; |
160 export 'matcher.dart'; | 169 export 'matcher.dart'; |
161 | 170 |
162 // TODO(amouravski): We should not need to import mock here, but it's necessary | 171 // 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 } | 864 } |
856 | 865 |
857 /** Enable a test by ID. */ | 866 /** Enable a test by ID. */ |
858 void enableTest(int testId) => _setTestEnabledState(testId, true); | 867 void enableTest(int testId) => _setTestEnabledState(testId, true); |
859 | 868 |
860 /** Disable a test by ID. */ | 869 /** Disable a test by ID. */ |
861 void disableTest(int testId) => _setTestEnabledState(testId, false); | 870 void disableTest(int testId) => _setTestEnabledState(testId, false); |
862 | 871 |
863 /** Signature for a test function. */ | 872 /** Signature for a test function. */ |
864 typedef dynamic TestFunction(); | 873 typedef dynamic TestFunction(); |
OLD | NEW |