OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #import('dart:io'); | 10 #import('dart:io'); |
11 #source('shared.dart'); | 11 #source('shared.dart'); |
12 | 12 |
13 _platformInitialize() { | 13 _platformInitialize() { |
14 // Do nothing. | 14 // Do nothing. |
15 } | 15 } |
16 | 16 |
17 _platformDefer(void callback()) { | 17 _platformDefer(void callback()) { |
18 new Timer((timer) { | 18 new Timer(0, (timer) { |
19 callback(); | 19 callback(); |
20 }, 0); | 20 }); |
21 } | 21 } |
22 | 22 |
23 _platformStartTests() { | 23 _platformStartTests() { |
24 // Do nothing. | 24 // Do nothing. |
25 } | 25 } |
26 | 26 |
27 _platformCompleteTests(int testsPassed, int testsFailed, int testsErrors) { | 27 _platformCompleteTests(int testsPassed, int testsFailed, int testsErrors) { |
28 // Print each test's result. | 28 // Print each test's result. |
29 for (final test in _tests) { | 29 for (final test in _tests) { |
30 print('${test.result.toUpperCase()}: ${test.description}'); | 30 print('${test.result.toUpperCase()}: ${test.description}'); |
(...skipping 14 matching lines...) Expand all Loading... |
45 } else if (testsFailed == 0 && testsErrors == 0) { | 45 } else if (testsFailed == 0 && testsErrors == 0) { |
46 print('All $testsPassed tests passed.'); | 46 print('All $testsPassed tests passed.'); |
47 success = true; | 47 success = true; |
48 } else { | 48 } else { |
49 print('$testsPassed PASSED, $testsFailed FAILED, $testsErrors ERRORS'); | 49 print('$testsPassed PASSED, $testsFailed FAILED, $testsErrors ERRORS'); |
50 } | 50 } |
51 | 51 |
52 // A non-zero exit code is used by the test infrastructure to detect failure. | 52 // A non-zero exit code is used by the test infrastructure to detect failure. |
53 if (!success) exit(1); | 53 if (!success) exit(1); |
54 } | 54 } |
OLD | NEW |