5
5
library ;
6
6
7
7
import 'dart:async' ;
8
- import 'dart:convert' ;
9
8
10
9
import 'package:actions/actions.dart' ;
11
10
import 'package:actions/src/node/process_manager.dart' ;
@@ -29,7 +28,7 @@ void main() {
29
28
group ('run' , () {
30
29
test ('echo' , () async {
31
30
await check (processManager.run (['echo' , 'Hello' ])).completes (
32
- it ()
31
+ (it) => it
33
32
..has ((res) => res.exitCode, 'exitCode' ).equals (0 )
34
33
..has ((res) => res.stdout, 'stdout' ).equals ('Hello\n ' ),
35
34
);
@@ -38,7 +37,7 @@ void main() {
38
37
test ('pipe' , () async {
39
38
final echo = childProcess.spawn ('echo' , ['Hello' ]);
40
39
await check (processManager.run (['tee' ], pipe: echo)).completes (
41
- it ()
40
+ (it) => it
42
41
..has ((res) => res.exitCode, 'exitCode' ).equals (0 )
43
42
..has ((res) => res.stdout, 'stdout' ).equals ('Hello\n ' ),
44
43
);
@@ -52,39 +51,39 @@ void main() {
52
51
['echo' , 'Hello' ],
53
52
mode: mode,
54
53
);
55
- final expectedOutput = utf8.encode ('Hello\n ' );
56
54
unawaited (
57
- check (proc.stdout).withQueue.inOrder ([
58
- if (mode != ProcessStartMode .inheritStdio &&
59
- mode != ProcessStartMode .detached)
60
- // ignore: unawaited_futures
61
- it ()..emits (it ()..deepEquals (expectedOutput)),
62
- // ignore: unawaited_futures
63
- it ()..isDone (),
64
- ]),
55
+ expectLater (
56
+ proc.stdout.map (String .fromCharCodes),
57
+ emitsInOrder ([
58
+ if (mode != ProcessStartMode .inheritStdio &&
59
+ mode != ProcessStartMode .detached)
60
+ 'Hello\n ' ,
61
+ emitsDone,
62
+ ]),
63
+ ),
65
64
);
66
65
unawaited (
67
66
check (proc.stderr).withQueue.isDone (),
68
67
);
69
68
check (proc.pid).isGreaterThan (0 );
70
- await check (proc.exitCode).completes (it () ..equals (0 ));
69
+ await check (proc.exitCode).completes ((it) => it ..equals (0 ));
71
70
});
72
71
}
73
72
74
73
test ('start (pipe)' , () async {
75
74
final echo = childProcess.spawn ('echo' , ['Hello' ]);
76
75
final proc = await processManager.start (['tee' ], pipe: echo);
77
76
unawaited (
78
- check (proc.stdout).withQueue. inOrder ([
79
- it ()
80
- // ignore: unawaited_futures
81
- .. emits ( it ().. deepEquals (utf8. encode ( 'Hello\n ' ))) ,
82
- // ignore: unawaited_futures
83
- it ().. isDone ( ),
84
- ] ),
77
+ expectLater (
78
+ proc.stdout. map ( String .fromCharCodes),
79
+ emitsInOrder ([
80
+ 'Hello\n ' ,
81
+ emitsDone,
82
+ ] ),
83
+ ),
85
84
);
86
85
unawaited (check (proc.stderr).withQueue.isDone ());
87
- await check (proc.exitCode).completes (it () ..equals (0 ));
86
+ await check (proc.exitCode).completes ((it) => it ..equals (0 ));
88
87
});
89
88
});
90
89
});
0 commit comments