OLD | NEW |
---|---|
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 part of unittestTest; | 5 part of unittestTest; |
6 | 6 |
7 Future _defer(void fn()) { | 7 Future _defer(void fn()) { |
8 return new Future.sync(fn); | 8 return (new Future.value()).then((_) => fn()); |
kevmoo
2014/07/29 19:59:02
Why not
return new Future(() => fn());
?
Could
Paul Berry
2014/07/29 21:54:38
In fact, this works too and is even shorter:
re
| |
9 } | 9 } |
10 | 10 |
11 String buildStatusString(int passed, int failed, int errors, | 11 String buildStatusString(int passed, int failed, int errors, |
12 var results, | 12 var results, |
13 {int count: 0, | 13 {int count: 0, |
14 String setup: '', String teardown: '', | 14 String setup: '', String teardown: '', |
15 String uncaughtError: null, | 15 String uncaughtError: null, |
16 String message: ''}) { | 16 String message: ''}) { |
17 var totalTests = 0; | 17 var totalTests = 0; |
18 var testDetails = new StringBuffer(); | 18 var testDetails = new StringBuffer(); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 testFunction(testConfig); | 84 testFunction(testConfig); |
85 } | 85 } |
86 | 86 |
87 void main() { | 87 void main() { |
88 var replyPort = new ReceivePort(); | 88 var replyPort = new ReceivePort(); |
89 Isolate.spawn(runTestInIsolate, replyPort.sendPort); | 89 Isolate.spawn(runTestInIsolate, replyPort.sendPort); |
90 replyPort.first.then((String msg) { | 90 replyPort.first.then((String msg) { |
91 expect(msg.trim(), expected); | 91 expect(msg.trim(), expected); |
92 }); | 92 }); |
93 } | 93 } |
OLD | NEW |