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

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

Issue 10627008: Added the ability to filter which tests are run by name, using a --filter (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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/unittest.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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 } 54 }
55 } 55 }
56 56
57 // Show the summary. 57 // Show the summary.
58 print(''); 58 print('');
59 59
60 var success = false; 60 var success = false;
61 if (passed == 0 && failed == 0 && errors == 0) { 61 if (passed == 0 && failed == 0 && errors == 0) {
62 print('No tests found.'); 62 print('No tests found.');
63 // This is considered a failure too: if this happens you probably have a 63 // This is considered a failure too: if this happens you probably have a
64 // bug in your unit tests. 64 // bug in your unit tests, unless you are filtering.
65 if (getFilter() != null) {
66 success = true;
67 }
65 } else if (failed == 0 && errors == 0 && uncaughtError == null) { 68 } else if (failed == 0 && errors == 0 && uncaughtError == null) {
66 print('All $passed tests passed.'); 69 print('All $passed tests passed.');
67 success = true; 70 success = true;
68 } else { 71 } else {
69 if (uncaughtError != null) { 72 if (uncaughtError != null) {
70 print('Top-level uncaught error: $uncaughtError'); 73 print('Top-level uncaught error: $uncaughtError');
71 } 74 }
72 print('$passed PASSED, $failed FAILED, $errors ERRORS'); 75 print('$passed PASSED, $failed FAILED, $errors ERRORS');
73 } 76 }
74 77
75 // An exception is used by the test infrastructure to detect failure. 78 // An exception is used by the test infrastructure to detect failure.
76 if (!success) throw new Exception("Some tests failed."); 79 if (!success) throw new Exception("Some tests failed.");
77 } 80 }
78 81
79 String _indent(String str) { 82 String _indent(String str) {
80 // TODO(nweiz): Use this simpler code once issue 2980 is fixed. 83 // TODO(nweiz): Use this simpler code once issue 2980 is fixed.
81 // return str.replaceAll(const RegExp("^", multiLine: true), " "); 84 // return str.replaceAll(const RegExp("^", multiLine: true), " ");
82 85
83 return Strings.join(str.split("\n").map((line) => " $line"), "\n"); 86 return Strings.join(str.split("\n").map((line) => " $line"), "\n");
84 } 87 }
85 } 88 }
OLDNEW
« no previous file with comments | « no previous file | lib/unittest/unittest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698