8
8
*/
9
9
library run_impl;
10
10
11
+ import 'dart:async' ;
11
12
import 'dart:io' ;
12
13
import 'dart:utf' show encodeUtf8;
13
14
import 'dart:isolate' ;
15
+ import 'package:unittest/compact_vm_config.dart' ;
14
16
import 'package:unittest/unittest.dart' ;
15
17
import 'package:web_ui/dwc.dart' as dwc;
16
18
17
19
import 'ast_test.dart' as ast_test;
18
- import 'compact_vm_config.dart' ;
19
20
20
21
// TODO(jacobr): command line args to filter tests
21
22
main () {
@@ -42,7 +43,7 @@ main() {
42
43
43
44
test ('drt-compile $filename ' , () {
44
45
expect (dwc.run (['-o' , 'data/output/' , path], printTime: false )
45
- .transform ((res) {
46
+ .then ((res) {
46
47
expect (res.messages.length, 0 ,
47
48
reason: Strings .join (res.messages, '\n ' ));
48
49
}), completes);
@@ -54,14 +55,14 @@ main() {
54
55
var outputPath = '$htmlPath .txt' ;
55
56
var errorPath = outDir.append ('_errors.$filename .txt' ).toString ();
56
57
57
- expect (_runDrt (htmlPath, outputPath, errorPath).transform ((exitCode) {
58
+ expect (_runDrt (htmlPath, outputPath, errorPath).then ((exitCode) {
58
59
if (exitCode == 0 ) {
59
60
var expectedPath = '$cwd /data/expected/$filename .txt' ;
60
- expect (_diff (expectedPath, outputPath).transform ((res) {
61
+ expect (_diff (expectedPath, outputPath).then ((res) {
61
62
expect (res, 0 , reason: "Test output doesn't match expectation." );
62
63
}), completes);
63
64
} else {
64
- expect (Process .run ('cat' , [errorPath]).transform ((res) {
65
+ expect (Process .run ('cat' , [errorPath]).then ((res) {
65
66
expect (exitCode, 0 , reason:
66
67
'DumpRenderTree exited with a non-zero exit code, when running '
67
68
'on $filename . Contents of stderr: \n ${res .stdout }' );
@@ -73,20 +74,20 @@ main() {
73
74
}
74
75
75
76
Future <int > _runDrt (htmlPath, String outPath, String errPath) {
76
- return Process .run ('DumpRenderTree' , [htmlPath]).chain ((res) {
77
+ return Process .run ('DumpRenderTree' , [htmlPath]).then ((res) {
77
78
var f1 = _writeFile (outPath, res.stdout);
78
79
var f2 = _writeFile (errPath, res.stderr);
79
- return Futures .wait ([f1, f2]).transform ((_) => res.exitCode);
80
+ return Future .wait ([f1, f2]).then ((_) => res.exitCode);
80
81
});
81
82
}
82
83
83
84
Future _writeFile (String path, String text) {
84
85
return new File (path).open (FileMode .WRITE )
85
- .chain ((file) => file.writeString (text))
86
- .chain ((file) => file.close ());
86
+ .then ((file) => file.writeString (text))
87
+ .then ((file) => file.close ());
87
88
}
88
89
89
90
Future <int > _diff (expectedPath, outputPath) {
90
91
return Process .run ('diff' , ['-q' , expectedPath, outputPath])
91
- .transform ((res) => res.exitCode);
92
+ .then ((res) => res.exitCode);
92
93
}
0 commit comments