| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * A simple unit test entrypoint for running tests on node compiled with frog. | |
| 7 */ | |
| 8 #library("unittest"); | |
| 9 | |
| 10 #import('../../../frog/lib/node/node.dart'); | |
| 11 | |
| 12 #source("shared.dart"); | |
| 13 | |
| 14 _platformInitialize() { | |
| 15 // Do nothing. | |
| 16 } | |
| 17 | |
| 18 _platformDefer(void callback()) { | |
| 19 setTimeout(callback, 0); | |
| 20 } | |
| 21 | |
| 22 _platformStartTests() { | |
| 23 // Do nothing. | |
| 24 } | |
| 25 | |
| 26 _platformCompleteTests(int testsPassed, int testsFailed, int testsErrors) { | |
| 27 // Print each test's result. | |
| 28 for (final test in _tests) { | |
| 29 print('${test.result.toUpperCase()}: ${test.description}'); | |
| 30 | |
| 31 if (test.message != '') { | |
| 32 print(' ${test.message}'); | |
| 33 } | |
| 34 } | |
| 35 | |
| 36 // Show the summary. | |
| 37 print(''); | |
| 38 | |
| 39 var success = false; | |
| 40 if (testsPassed == 0 && testsFailed == 0 && testsErrors == 0) { | |
| 41 print('No tests found.'); | |
| 42 // This is considered a failure too: if this happens you probably have a | |
| 43 // bug in your unit tests. | |
| 44 } else if (testsFailed == 0 && testsErrors == 0) { | |
| 45 print('All $testsPassed tests passed.'); | |
| 46 success = true; | |
| 47 } else { | |
| 48 print('$testsPassed PASSED, $testsFailed FAILED, $testsErrors ERRORS'); | |
| 49 } | |
| 50 | |
| 51 // A non-zero exit code is used by the test infrastructure to detect failure. | |
| 52 if (!success) process.exit(1); | |
| 53 } | |
| OLD | NEW |