Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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) { |
| 164 testCase.recordSuccess(); | |
| 165 if (!_testIsRunning) { | 164 if (!_testIsRunning) { |
|
Siggi Cherem (dart-lang)
2011/10/20 15:00:13
(nit) maybe this fits together with the previous c
Anton Muhin
2011/10/20 16:59:06
Thanks, nice, done.
| |
| 165 testCase.recordSuccess(); | |
| 166 _currentTest++; | 166 _currentTest++; |
| 167 _nextBatch(); | 167 _nextBatch(); |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 | 171 |
| 172 /** | 172 /** |
| 173 * Runs a batch of tests, yielding whenever an asynchronous test starts | 173 * Runs a batch of tests, yielding whenever an asynchronous test starts |
| 174 * running. Tests will resume executing when such asynchronous test calls | 174 * running. Tests will resume executing when such asynchronous test calls |
| 175 * [done] or if it fails with an exception. | 175 * [done] or if it fails with an exception. |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 526 </tr>"""; | 526 </tr>"""; |
| 527 if (stackTrace != null) { | 527 if (stackTrace != null) { |
| 528 message += | 528 message += |
| 529 "<tr><td></td><td colspan='2'><pre>${stackTrace}</pre></td></tr>"; | 529 "<tr><td></td><td colspan='2'><pre>${stackTrace}</pre></td></tr>"; |
| 530 } | 530 } |
| 531 fail = true; | 531 fail = true; |
| 532 } | 532 } |
| 533 } | 533 } |
| 534 | 534 |
| 535 typedef void TestFunction(); | 535 typedef void TestFunction(); |
| OLD | NEW |