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

Side by Side Diff: client/testing/unittest/unittestsuite.dart

Issue 8344084: Do not mark test as successful in callbackDone if test is (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 2 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 | no next file » | 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 // TODO(rnystrom): This code is gradually moving from a Java/JUnit style to 5 // TODO(rnystrom): This code is gradually moving from a Java/JUnit style to
6 // something closer to JS/Jasmine. Eventually, the UnitTestSuite class can go 6 // something closer to JS/Jasmine. Eventually, the UnitTestSuite class can go
7 // away completely (or become private to this library) and the only exposed API 7 // away completely (or become private to this library) and the only exposed API
8 // will be group()/test()/expect(). Until then, both ways are supported, which 8 // will be group()/test()/expect(). Until then, both ways are supported, which
9 // is why things look a bit weird in here. 9 // is why things look a bit weird in here.
10 10
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 if (testCase.callbacks == 0) { 153 if (testCase.callbacks == 0) {
154 testCase.recordError( 154 testCase.recordError(
155 "Can't call callbackDone() on a synchronous test", ''); 155 "Can't call callbackDone() on a synchronous test", '');
156 _uncaughtError = true; 156 _uncaughtError = true;
157 } else if (_callbacksCalled > testCase.callbacks) { 157 } else if (_callbacksCalled > testCase.callbacks) {
158 final expected = testCase.callbacks; 158 final expected = testCase.callbacks;
159 testCase.recordError( 159 testCase.recordError(
160 'More calls to callbackDone() than expected. ' 160 'More calls to callbackDone() than expected. '
161 + 'Actual: ${_callbacksCalled}, expected: ${expected}', ''); 161 + 'Actual: ${_callbacksCalled}, expected: ${expected}', '');
162 _uncaughtError = true; 162 _uncaughtError = true;
163 } else if (_callbacksCalled == testCase.callbacks) { 163 } else if (_callbacksCalled == testCase.callbacks && !_testIsRunning) {
164 testCase.recordSuccess(); 164 testCase.recordSuccess();
165 if (!_testIsRunning) { 165 _currentTest++;
166 _currentTest++; 166 _nextBatch();
167 _nextBatch();
168 }
169 } 167 }
170 } 168 }
171 169
172 /** 170 /**
173 * Runs a batch of tests, yielding whenever an asynchronous test starts 171 * Runs a batch of tests, yielding whenever an asynchronous test starts
174 * running. Tests will resume executing when such asynchronous test calls 172 * running. Tests will resume executing when such asynchronous test calls
175 * [done] or if it fails with an exception. 173 * [done] or if it fails with an exception.
176 */ 174 */
177 void _nextBatch() { 175 void _nextBatch() {
178 while (_currentTest < _tests.length) { 176 while (_currentTest < _tests.length) {
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 </tr>"""; 524 </tr>""";
527 if (stackTrace != null) { 525 if (stackTrace != null) {
528 message += 526 message +=
529 "<tr><td></td><td colspan='2'><pre>${stackTrace}</pre></td></tr>"; 527 "<tr><td></td><td colspan='2'><pre>${stackTrace}</pre></td></tr>";
530 } 528 }
531 fail = true; 529 fail = true;
532 } 530 }
533 } 531 }
534 532
535 typedef void TestFunction(); 533 typedef void TestFunction();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698