| 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 * A simple unit test library for running tests on the VM. | 6 * A simple unit test library for running tests on the VM. |
| 7 */ | 7 */ |
| 8 #library("unittest"); | 8 #library("unittest"); |
| 9 | 9 |
| 10 #source("shared.dart"); | 10 #source("shared.dart"); |
| 11 | 11 |
| 12 _platformInitialize() { | 12 _platformInitialize() { |
| 13 // Do nothing. | 13 // Do nothing. |
| 14 } | 14 } |
| 15 | 15 |
| 16 _platformDefer(void callback()) { | 16 _platformDefer(void callback()) { |
| 17 new Timer((timer) { | 17 new Timer((timer) { |
| 18 callback(); | 18 callback(); |
| 19 }, 0, false); | 19 }, 0); |
| 20 } | 20 } |
| 21 | 21 |
| 22 _platformStartTests() { | 22 _platformStartTests() { |
| 23 // Do nothing. | 23 // Do nothing. |
| 24 } | 24 } |
| 25 | 25 |
| 26 _platformCompleteTests(int testsPassed, int testsFailed, int testsErrors) { | 26 _platformCompleteTests(int testsPassed, int testsFailed, int testsErrors) { |
| 27 // Print each test's result. | 27 // Print each test's result. |
| 28 for (final test in _tests) { | 28 for (final test in _tests) { |
| 29 print('${test.result.toUpperCase()}: ${test.description}'); | 29 print('${test.result.toUpperCase()}: ${test.description}'); |
| 30 | 30 |
| 31 if (test.message != '') { | 31 if (test.message != '') { |
| 32 print(' ${test.message}'); | 32 print(' ${test.message}'); |
| 33 } | 33 } |
| 34 } | 34 } |
| 35 | 35 |
| 36 // Show the summary. | 36 // Show the summary. |
| 37 print(''); | 37 print(''); |
| 38 | 38 |
| 39 if (testsPassed == 0 && testsFailed == 0 && testsErrors == 0) { | 39 if (testsPassed == 0 && testsFailed == 0 && testsErrors == 0) { |
| 40 print('No tests found.'); | 40 print('No tests found.'); |
| 41 } else if (testsFailed == 0 && testsErrors == 0) { | 41 } else if (testsFailed == 0 && testsErrors == 0) { |
| 42 print('All $testsPassed tests passed.'); | 42 print('All $testsPassed tests passed.'); |
| 43 } else { | 43 } else { |
| 44 print('$testsPassed PASSED, $testsFailed FAILED, $testsErrors ERRORS'); | 44 print('$testsPassed PASSED, $testsFailed FAILED, $testsErrors ERRORS'); |
| 45 } | 45 } |
| 46 } | 46 } |
| OLD | NEW |