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

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

Issue 11791031: Some minor small fixes to unittest (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 | pkg/unittest/lib/src/core_matchers.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 part of unittest; 5 part of unittest;
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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } else if (failed == 0 && errors == 0 && uncaughtError == null) { 122 } else if (failed == 0 && errors == 0 && uncaughtError == null) {
123 print('All $passed tests passed.'); 123 print('All $passed tests passed.');
124 success = true; 124 success = true;
125 } else { 125 } else {
126 if (uncaughtError != null) { 126 if (uncaughtError != null) {
127 print('Top-level uncaught error: $uncaughtError'); 127 print('Top-level uncaught error: $uncaughtError');
128 } 128 }
129 print('$passed PASSED, $failed FAILED, $errors ERRORS'); 129 print('$passed PASSED, $failed FAILED, $errors ERRORS');
130 } 130 }
131 131
132 _receivePort.close();
133 if (success) { 132 if (success) {
134 _postMessage('unittest-suite-success'); 133 _postMessage('unittest-suite-success');
135 _receivePort.close(); 134 _receivePort.close();
136 } else { 135 } else {
136 _receivePort.close();
137 throw new Exception('Some tests failed.'); 137 throw new Exception('Some tests failed.');
138 } 138 }
139 } 139 }
140 140
141 String _indent(String str) { 141 String _indent(String str) {
142 // TODO(nweiz): Use this simpler code once issue 2980 is fixed. 142 // TODO(nweiz): Use this simpler code once issue 2980 is fixed.
143 // return str.replaceAll(new RegExp("^", multiLine: true), " "); 143 // return str.replaceAll(new RegExp("^", multiLine: true), " ");
144 144
145 return Strings.join(str.split("\n").mappedBy((line) => " $line"), "\n"); 145 return Strings.join(str.split("\n").mappedBy((line) => " $line"), "\n");
146 } 146 }
147 147
148 /** Handle errors that happen outside the tests. */ 148 /** Handle errors that happen outside the tests. */
149 // TODO(vsm): figure out how to expose the stack trace here 149 // TODO(vsm): figure out how to expose the stack trace here
150 // Currently e.message works in dartium, but not in dartc. 150 // Currently e.message works in dartium, but not in dartc.
151 handleExternalError(e, String message) => 151 handleExternalError(e, String message) =>
152 _reportTestError('$message\nCaught $e', ''); 152 _reportTestError('$message\nCaught $e', '');
153 153
154 _postMessage(String message) { 154 _postMessage(String message) {
155 // In dart2js browser tests, the JavaScript-based test controller 155 // In dart2js browser tests, the JavaScript-based test controller
156 // intercepts calls to print and listens for "secret" messages. 156 // intercepts calls to print and listens for "secret" messages.
157 print(message); 157 print(message);
158 } 158 }
159 } 159 }
OLDNEW
« no previous file with comments | « no previous file | pkg/unittest/lib/src/core_matchers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698