OLD | NEW |
1 // Copyright (c) 2012, 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 // TODO(gram): | 5 // TODO(gram): |
6 // Unfortunately I can't seem to test anything that involves timeouts, e.g. | 6 // Unfortunately I can't seem to test anything that involves timeouts, e.g. |
7 // insufficient callbacks, because the timeout is controlled externally | 7 // insufficient callbacks, because the timeout is controlled externally |
8 // (test.dart?), and we would need to use a shorter timeout for the inner tests | 8 // (test.dart?), and we would need to use a shorter timeout for the inner tests |
9 // so the outer timeout doesn't fire. So I removed all such tests. | 9 // so the outer timeout doesn't fire. So I removed all such tests. |
10 // I'd like to revisit this at some point. | 10 // I'd like to revisit this at some point. |
11 | 11 |
12 #library('unittestTest'); | 12 library unittestTest; |
13 #import('dart:isolate'); | 13 import 'dart:isolate'; |
14 #import('../../../pkg/unittest/unittest.dart'); | 14 import '../../../pkg/unittest/lib/unittest.dart'; |
15 | 15 |
16 var tests; // array of test names | 16 var tests; // array of test names |
17 var expected; // array of test expected results (from buildStatusString) | 17 var expected; // array of test expected results (from buildStatusString) |
18 var actual; // actual test results (from buildStatusString in config.onDone) | 18 var actual; // actual test results (from buildStatusString in config.onDone) |
19 var _testconfig; // test configuration to capture onDone | 19 var _testconfig; // test configuration to capture onDone |
20 | 20 |
21 _defer(void fn()) { | 21 _defer(void fn()) { |
22 // Exploit isolate ports as a platform-independent mechanism to queue a | 22 // Exploit isolate ports as a platform-independent mechanism to queue a |
23 // message at the end of the event loop. Stolen from unittest.dart. | 23 // message at the end of the event loop. Stolen from unittest.dart. |
24 final port = new ReceivePort(); | 24 final port = new ReceivePort(); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 buildStatusString(0, 1, 0, tests[10], message: 'Caught error!'), | 203 buildStatusString(0, 1, 0, tests[10], message: 'Caught error!'), |
204 buildStatusString(1, 0, 1, 'testOne', message: 'Callback called after alread
y being marked as done (1).:testTwo:'), | 204 buildStatusString(1, 0, 1, 'testOne', message: 'Callback called after alread
y being marked as done (1).:testTwo:'), |
205 buildStatusString(2, 1, 0, 'testOne::testTwo:Expected: false but: was <true>
.:testThree') | 205 buildStatusString(2, 1, 0, 'testOne::testTwo:Expected: false but: was <true>
.:testThree') |
206 ]; | 206 ]; |
207 | 207 |
208 actual = []; | 208 actual = []; |
209 | 209 |
210 nextTest(0); | 210 nextTest(0); |
211 } | 211 } |
212 | 212 |
OLD | NEW |