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

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

Issue 10037027: unittest step2: bye bye to multiple entrypoints for unittest (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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 | « frog/tests/frog/src/unittest_node.dart ('k') | lib/unittest/dom_config.dart » ('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 /** This file is sourced by unitest.dart. */
6
5 /** 7 /**
6 * Hooks to configure the unittest library for different platforms. This class 8 * Hooks to configure the unittest library for different platforms. This class
7 * implements the API in a platform-independent way. Tests that want to take 9 * implements the API in a platform-independent way. Tests that want to take
8 * advantage of the platform can create a subclass and override methods from 10 * advantage of the platform can create a subclass and override methods from
9 * this class. 11 * this class.
10 */ 12 */
11 class Configuration { 13 class Configuration {
12 /** 14 /**
13 * Called as soon as the unittest framework becomes initialized. This is done 15 * Called as soon as the unittest framework becomes initialized. This is done
14 * even before tests are added to the test framework. It might be used to 16 * even before tests are added to the test framework. It might be used to
(...skipping 14 matching lines...) Expand all
29 */ 31 */
30 void onTestResult(TestCase testCase) {} 32 void onTestResult(TestCase testCase) {}
31 33
32 /** 34 /**
33 * Called with the result of all test cases. The default implementation prints 35 * Called with the result of all test cases. The default implementation prints
34 * the result summary using the built-in [print] command. Browser tests 36 * the result summary using the built-in [print] command. Browser tests
35 * commonly override this to reformat the output. 37 * commonly override this to reformat the output.
36 */ 38 */
37 void onDone(int passed, int failed, int errors, List<TestCase> results) { 39 void onDone(int passed, int failed, int errors, List<TestCase> results) {
38 // Print each test's result. 40 // Print each test's result.
39 for (final test in _tests) { 41 for (final t in _tests) {
40 print('${test.result.toUpperCase()}: ${test.description}'); 42 print('${t.result.toUpperCase()}: ${t.description}');
41 43
42 if (test.message != '') { 44 if (t.message != '') {
43 print(' ${test.message}'); 45 print(' ${t.message}');
44 } 46 }
45 } 47 }
46 48
47 // Show the summary. 49 // Show the summary.
48 print(''); 50 print('');
49 51
50 var success = false; 52 var success = false;
51 if (passed == 0 && failed == 0 && errors == 0) { 53 if (passed == 0 && failed == 0 && errors == 0) {
52 print('No tests found.'); 54 print('No tests found.');
53 // This is considered a failure too: if this happens you probably have a 55 // This is considered a failure too: if this happens you probably have a
54 // bug in your unit tests. 56 // bug in your unit tests.
55 } else if (failed == 0 && errors == 0) { 57 } else if (failed == 0 && errors == 0) {
56 print('All $passed tests passed.'); 58 print('All $passed tests passed.');
57 success = true; 59 success = true;
58 } else { 60 } else {
59 print('$passed PASSED, $failed FAILED, $errors ERRORS'); 61 print('$passed PASSED, $failed FAILED, $errors ERRORS');
60 } 62 }
61 63
62 // An exception is used by the test infrastructure to detect failure. 64 // An exception is used by the test infrastructure to detect failure.
63 if (!success) throw new Exception("Some tests failed."); 65 if (!success) throw new Exception("Some tests failed.");
64 } 66 }
65 } 67 }
OLDNEW
« no previous file with comments | « frog/tests/frog/src/unittest_node.dart ('k') | lib/unittest/dom_config.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698