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

Side by Side Diff: lib/unittest/unittest.dart

Issue 10389223: Add unittest to apidoc and fix readme. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | utils/apidoc/README.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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, specify the relative path to lib/unittest.dart.
Siggi Cherem (dart-lang) 2012/05/18 23:33:32 lib/unittest.dart => lib/unittest/unittest.dart
9 *
8 * ##Concepts## 10 * ##Concepts##
9 * 11 *
10 * * Tests: Tests are specified via the top-level function [test], they can be 12 * * Tests: Tests are specified via the top-level function [test], they can be
11 * organized together using [group]. 13 * organized together using [group].
12 * * Checks: Test expectations can be specified via [expect] (see methods in 14 * * Checks: Test expectations can be specified via [expect] (see methods in
13 * [Expectation]), [expectThrow], or using assertions with the [Expect] 15 * [Expectation]), [expectThrow], or using assertions with the [Expect]
14 * class. 16 * class.
15 * * Configuration: The framework can be adapted by calling [configure] with a 17 * * Configuration: The framework can be adapted by calling [configure] with a
16 * [Configuration]. Common configurations can be found in this package 18 * [Configuration]. Common configurations can be found in this package
17 * under: 'dom\_config.dart', 'html\_config.dart', and 'vm\_config.dart'. 19 * under: 'dom\_config.dart', 'html\_config.dart', and 'vm\_config.dart'.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 * }, count: 2); // <-- we can indicate multiplicity to [expectAsync0] 87 * }, count: 2); // <-- we can indicate multiplicity to [expectAsync0]
86 * window.setTimeout(callback, 0); 88 * window.setTimeout(callback, 0);
87 * window.setTimeout(callback, 0); 89 * window.setTimeout(callback, 0);
88 * }); 90 * });
89 * } 91 * }
90 * 92 *
91 * Note: due to some language limitations we have to use different functions 93 * Note: due to some language limitations we have to use different functions
92 * depending on the number of positional arguments of the callback. In the 94 * depending on the number of positional arguments of the callback. In the
93 * future, we plan to expose a single `expectAsync` function that can be used 95 * future, we plan to expose a single `expectAsync` function that can be used
94 * regardless of the number of positional arguments. This requires new langauge 96 * regardless of the number of positional arguments. This requires new langauge
95 * features or fixes to the current spec (e.g. see dartbug.com/2706). 97 * features or fixes to the current spec (e.g. see dartbug.com/2706).
Siggi Cherem (dart-lang) 2012/05/18 23:33:32 let's make this url a link.
96 * 98 *
97 * Meanwhile, we plan to add this alternative API for callbacks of more than 2 99 * Meanwhile, we plan to add this alternative API for callbacks of more than 2
98 * arguments or that take named parameters. (this is not implemented yet, 100 * arguments or that take named parameters. (this is not implemented yet,
99 * but will be coming here soon). 101 * but will be coming here soon).
100 * 102 *
101 * #import('path-to-dart/lib/unittest/unitest.dart'); 103 * #import('path-to-dart/lib/unittest/unitest.dart');
102 * #import('dart:dom_deprecated'); 104 * #import('dart:dom_deprecated');
103 * main() { 105 * main() {
104 * test('calllback is executed', () { 106 * test('calllback is executed', () {
105 * // indicate ahead of time that an async callback is expected. 107 * // indicate ahead of time that an async callback is expected.
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 } 569 }
568 _config.onInit(); 570 _config.onInit();
569 571
570 // Immediately queue the suite up. It will run after a timeout (i.e. after 572 // Immediately queue the suite up. It will run after a timeout (i.e. after
571 // main() has returned). 573 // main() has returned).
572 _defer(_runTests); 574 _defer(_runTests);
573 } 575 }
574 576
575 /** Signature for a test function. */ 577 /** Signature for a test function. */
576 typedef void TestFunction(); 578 typedef void TestFunction();
OLDNEW
« no previous file with comments | « no previous file | utils/apidoc/README.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698