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

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

Issue 10226008: Revert "unittest step 3 and 4: remove TestFramework.dart, make test.dart use" (Closed) Base URL: https://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 | 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. */ 5 /** This file is sourced by unitest.dart. */
6 6
7 /** 7 /**
8 * Hooks to configure the unittest library for different platforms. This class 8 * Hooks to configure the unittest library for different platforms. This class
9 * 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
10 * 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
(...skipping 17 matching lines...) Expand all
28 /** 28 /**
29 * Called when each test is completed. Useful to show intermediate progress on 29 * Called when each test is completed. Useful to show intermediate progress on
30 * a test suite. 30 * a test suite.
31 */ 31 */
32 void onTestResult(TestCase testCase) {} 32 void onTestResult(TestCase testCase) {}
33 33
34 /** 34 /**
35 * 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
36 * the result summary using the built-in [print] command. Browser tests 36 * the result summary using the built-in [print] command. Browser tests
37 * commonly override this to reformat the output. 37 * commonly override this to reformat the output.
38 *
39 * When [uncaughtError] is not null, it contains an error that occured outside
40 * of tests (e.g. setting up the test).
41 */ 38 */
42 void onDone(int passed, int failed, int errors, List<TestCase> results, 39 void onDone(int passed, int failed, int errors, List<TestCase> results) {
43 String uncaughtError) {
44 // Print each test's result. 40 // Print each test's result.
45 for (final t in _tests) { 41 for (final t in _tests) {
46 print('${t.result.toUpperCase()}: ${t.description}'); 42 print('${t.result.toUpperCase()}: ${t.description}');
47 43
48 if (t.message != '') { 44 if (t.message != '') {
49 print(' ${t.message}'); 45 print(' ${t.message}');
50 } 46 }
51 } 47 }
52 48
53 // Show the summary. 49 // Show the summary.
54 print(''); 50 print('');
55 51
56 var success = false; 52 var success = false;
57 if (passed == 0 && failed == 0 && errors == 0) { 53 if (passed == 0 && failed == 0 && errors == 0) {
58 print('No tests found.'); 54 print('No tests found.');
59 // 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
60 // bug in your unit tests. 56 // bug in your unit tests.
61 } else if (failed == 0 && errors == 0 && uncaughtError == null) { 57 } else if (failed == 0 && errors == 0) {
62 print('All $passed tests passed.'); 58 print('All $passed tests passed.');
63 success = true; 59 success = true;
64 } else { 60 } else {
65 if (uncaughtError != null) {
66 print('Top-level uncaught error: $uncaughtError');
67 }
68 print('$passed PASSED, $failed FAILED, $errors ERRORS'); 61 print('$passed PASSED, $failed FAILED, $errors ERRORS');
69 } 62 }
70 63
71 // An exception is used by the test infrastructure to detect failure. 64 // An exception is used by the test infrastructure to detect failure.
72 if (!success) throw new Exception("Some tests failed."); 65 if (!success) throw new Exception("Some tests failed.");
73 } 66 }
74 } 67 }
OLDNEW
« no previous file with comments | « no previous file | lib/unittest/dom_config.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698