8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
+ use std:: path:: BytesContainer ;
11
12
use std:: io:: { Command , fs, USER_RWX } ;
12
13
use std:: os;
13
14
14
15
fn main ( ) {
15
16
// If we're the child, make sure we were invoked correctly
16
17
let args = os:: args ( ) ;
17
18
if args. len ( ) > 1 && args[ 1 ] . as_slice ( ) == "child" {
18
- return assert_eq ! ( args[ 0 ] . as_slice( ) , "mytest" ) ;
19
+ return assert_eq ! ( args[ 0 ] ,
20
+ format!( "mytest{}" , os:: consts:: EXE_SUFFIX ) ) ;
19
21
}
20
22
21
23
test ( ) ;
@@ -38,7 +40,12 @@ fn test() {
38
40
path. push ( child_dir. clone ( ) ) ;
39
41
let path = os:: join_paths ( path. as_slice ( ) ) . unwrap ( ) ;
40
42
41
- assert ! ( Command :: new( "mytest" ) . env( "PATH" , path. as_slice( ) )
42
- . arg( "child" )
43
- . status( ) . unwrap( ) . success( ) ) ;
43
+ let child_output = Command :: new ( "mytest" ) . env ( "PATH" , path. as_slice ( ) )
44
+ . arg ( "child" )
45
+ . output ( ) . unwrap ( ) ;
46
+
47
+ assert ! ( child_output. status. success( ) ,
48
+ format!( "child assertion failed\n child stdout:\n {}\n child stderr:\n {}" ,
49
+ child_output. output. container_as_str( ) . unwrap( ) ,
50
+ child_output. error. container_as_str( ) . unwrap( ) ) ) ;
44
51
}
0 commit comments