File tree 2 files changed +13
-3
lines changed 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 1
1
fn main ( ) {
2
2
println ! ( "Hello, world!" ) ;
3
+ println ! ( "Hello, world again!" ) ;
3
4
}
Original file line number Diff line number Diff line change 1
1
use failure:: Error ;
2
2
use log:: LevelFilter ;
3
- use rustwide:: cmd:: SandboxBuilder ;
3
+ use rustwide:: cmd:: { ProcessLinesActions , SandboxBuilder } ;
4
4
5
5
#[ macro_use]
6
6
mod runner;
@@ -17,6 +17,9 @@ fn test_hello_world() {
17
17
} ) ?;
18
18
19
19
assert ! ( storage. to_string( ) . contains( "[stdout] Hello, world!\n " ) ) ;
20
+ assert ! ( storage
21
+ . to_string( )
22
+ . contains( "[stdout] Hello, world again!\n " ) ) ;
20
23
Ok ( ( ) )
21
24
} ) ?;
22
25
Ok ( ( ) )
@@ -32,9 +35,12 @@ fn test_process_lines() {
32
35
rustwide:: logging:: capture ( & storage, || -> Result < _ , Error > {
33
36
build
34
37
. cargo ( )
35
- . process_lines ( & mut |line : & str | {
36
- if line. contains ( "Hello, world!" ) {
38
+ . process_lines ( & mut |line : & str , actions : & mut ProcessLinesActions | {
39
+ if line. contains ( "Hello, world again !" ) {
37
40
ex = true ;
41
+ actions. replace_with_lines ( line. split ( "," ) ) ;
42
+ } else if line. contains ( "Hello, world!" ) {
43
+ actions. remove_line ( ) ;
38
44
}
39
45
} )
40
46
. args ( & [ "run" ] )
@@ -43,6 +49,9 @@ fn test_process_lines() {
43
49
} ) ?;
44
50
45
51
assert ! ( ex) ;
52
+ assert ! ( !storage. to_string( ) . contains( "[stdout] Hello, world!\n " ) ) ;
53
+ assert ! ( storage. to_string( ) . contains( "[stdout] world again!\n " ) ) ;
54
+ assert ! ( storage. to_string( ) . contains( "[stdout] Hello\n " ) ) ;
46
55
Ok ( ( ) )
47
56
} ) ?;
48
57
Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments