| 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 /** | 5 /** |
| 6 * Description text of the current test group. If multiple groups are nested, | 6 * Description text of the current test group. If multiple groups are nested, |
| 7 * this will contain all of their text concatenated. | 7 * this will contain all of their text concatenated. |
| 8 */ | 8 */ |
| 9 String _currentGroup = ''; | 9 String _currentGroup = ''; |
| 10 | 10 |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 _currentTest++; | 207 _currentTest++; |
| 208 } | 208 } |
| 209 | 209 |
| 210 _completeTests(); | 210 _completeTests(); |
| 211 } | 211 } |
| 212 | 212 |
| 213 /** Publish results on the page and notify controller. */ | 213 /** Publish results on the page and notify controller. */ |
| 214 _completeTests() { | 214 _completeTests() { |
| 215 _state = _UNINITIALIZED; | 215 _state = _UNINITIALIZED; |
| 216 | 216 |
| 217 int testsPassed = 0; | 217 int testsPassed_ = 0; |
| 218 int testsFailed = 0; | 218 int testsFailed_ = 0; |
| 219 int testsErrors = 0; | 219 int testsErrors_ = 0; |
| 220 | 220 |
| 221 for (TestCase t in _tests) { | 221 for (TestCase t in _tests) { |
| 222 switch (t.result) { | 222 switch (t.result) { |
| 223 case _PASS: testsPassed++; break; | 223 case _PASS: testsPassed_++; break; |
| 224 case _FAIL: testsFailed++; break; | 224 case _FAIL: testsFailed_++; break; |
| 225 case _ERROR: testsErrors++; break; | 225 case _ERROR: testsErrors_++; break; |
| 226 } | 226 } |
| 227 } | 227 } |
| 228 | 228 |
| 229 _platformCompleteTests(testsPassed, testsFailed, testsErrors); | 229 _platformCompleteTests(testsPassed_, testsFailed_, testsErrors_); |
| 230 } | 230 } |
| 231 | 231 |
| 232 String _fullSpec(String spec) { | 232 String _fullSpec(String spec) { |
| 233 if (spec === null) return '$_currentGroup'; | 233 if (spec === null) return '$_currentGroup'; |
| 234 return _currentGroup != '' ? '$_currentGroup $spec' : spec; | 234 return _currentGroup != '' ? '$_currentGroup $spec' : spec; |
| 235 } | 235 } |
| 236 | 236 |
| 237 /** | 237 /** |
| 238 * Lazily initializes the test library if not already initialized. | 238 * Lazily initializes the test library if not already initialized. |
| 239 */ | 239 */ |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 Duration runningTime; | 340 Duration runningTime; |
| 341 | 341 |
| 342 TestCase(this.id, this.description, this.test, this.callbacks); | 342 TestCase(this.id, this.description, this.test, this.callbacks); |
| 343 | 343 |
| 344 bool get isComplete() => result != null; | 344 bool get isComplete() => result != null; |
| 345 | 345 |
| 346 void pass() { | 346 void pass() { |
| 347 result = _PASS; | 347 result = _PASS; |
| 348 } | 348 } |
| 349 | 349 |
| 350 void fail(String message, String stackTrace) { | 350 void fail(String message_, String stackTrace_) { |
| 351 result = _FAIL; | 351 result = _FAIL; |
| 352 this.message = message; | 352 this.message = message_; |
| 353 this.stackTrace = stackTrace; | 353 this.stackTrace = stackTrace_; |
| 354 } | 354 } |
| 355 | 355 |
| 356 void error(String message, String stackTrace) { | 356 void error(String message_, String stackTrace_) { |
| 357 result = _ERROR; | 357 result = _ERROR; |
| 358 this.message = message; | 358 this.message = message_; |
| 359 this.stackTrace = stackTrace; | 359 this.stackTrace = stackTrace_; |
| 360 } | 360 } |
| 361 } | 361 } |
| 362 | 362 |
| 363 typedef void TestFunction(); | 363 typedef void TestFunction(); |
| OLD | NEW |