Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/site/articles/dart-unit-tests/index.markdown

Issue 12253042: add warning about importing multiple configs (Closed) Base URL: git@github.com:dart-lang/dartlang.org.git@master
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 --- 1 ---
2 layout: default 2 layout: default
3 title: "Unit Testing with Dart" 3 title: "Unit Testing with Dart"
4 rel: 4 rel:
5 author: graham-wheeler 5 author: graham-wheeler
6 description: "Using Dart's unit test library for synchronous and 6 description: "Using Dart's unit test library for synchronous and
7 asynchronous tests." 7 asynchronous tests."
8 has-permalinks: true 8 has-permalinks: true
9 article: 9 article:
10 written_on: 2012-06-01 10 written_on: 2012-06-01
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 {% prettify dart %} 218 {% prettify dart %}
219 import 'package:unittest/html_config.dart'; 219 import 'package:unittest/html_config.dart';
220 {% endprettify %} 220 {% endprettify %}
221 221
222 and add a line before the tests: 222 and add a line before the tests:
223 223
224 {% prettify dart %} 224 {% prettify dart %}
225 useHtmlConfiguration(); 225 useHtmlConfiguration();
226 {% endprettify %} 226 {% endprettify %}
227 227
228 <aside class="alert alert-warning" markdown="1">
229 **Important:**
230 Import and use **only one configuration.**
231 If you import multiple configuration files,
232 your tests won't run.
233 </aside>
234
228 Test results will be displayed in the Dartium window and exit codes are shown in the editor's Debugger tab. 235 Test results will be displayed in the Dartium window and exit codes are shown in the editor's Debugger tab.
229 236
230 The rest of this article dives deeper into the unit test library. 237 The rest of this article dives deeper into the unit test library.
231 238
232 ## Basic synchronous tests 239 ## Basic synchronous tests
233 240
234 Tests are created using the top level function `test()`. This function takes a n ame for the test and a function to execute. Typically the calls to `test()` woul d be in a `main()` function or in a function called from `main()`. In contrast t o some languages where reflection is used to determine unit test functions, in D art they must be explicitly called. 241 Tests are created using the top level function `test()`. This function takes a n ame for the test and a function to execute. Typically the calls to `test()` woul d be in a `main()` function or in a function called from `main()`. In contrast t o some languages where reflection is used to determine unit test functions, in D art they must be explicitly called.
235 242
236 Here is a trivial example to illustrate the syntax of `test()`: 243 Here is a trivial example to illustrate the syntax of `test()`:
237 244
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 configureExpectHandler(this); 756 configureExpectHandler(this);
750 } 757 }
751 void fail(String reason) { 758 void fail(String reason) {
752 ++errorCount; 759 ++errorCount;
753 } 760 }
754 } 761 }
755 {% endprettify %} 762 {% endprettify %}
756 763
757 Apart from the default failure handler, a reference to a failure handler can be explictly passed to an `expect()` call using the `failureHandler` named argument . 764 Apart from the default failure handler, a reference to a failure handler can be explictly passed to an `expect()` call using the `failureHandler` named argument .
758 765
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698