1
1
#![ cfg( feature = "integration" ) ]
2
2
3
3
use std:: env;
4
+ use std:: ffi:: OsStr ;
4
5
use std:: process:: Command ;
5
6
6
7
#[ cfg_attr( feature = "integration" , test) ]
@@ -12,13 +13,16 @@ fn integration_test() {
12
13
. nth ( 1 )
13
14
. expect ( "repo name should have format `<org>/<name>`" ) ;
14
15
15
- let repo_dir = tempfile:: tempdir ( )
16
- . expect ( "couldn't create temp dir" )
17
- . path ( )
18
- . join ( crate_name) ;
16
+ let mut repo_dir = tempfile:: tempdir ( ) . expect ( "couldn't create temp dir" ) . into_path ( ) ;
17
+ repo_dir. push ( crate_name) ;
19
18
20
19
let st = Command :: new ( "git" )
21
- . args ( & [ "clone" , "--depth=1" , & repo_url, repo_dir. to_str ( ) . unwrap ( ) ] )
20
+ . args ( & [
21
+ OsStr :: new ( "clone" ) ,
22
+ OsStr :: new ( "--depth=1" ) ,
23
+ OsStr :: new ( & repo_url) ,
24
+ OsStr :: new ( & repo_dir) ,
25
+ ] )
22
26
. status ( )
23
27
. expect ( "unable to run git" ) ;
24
28
assert ! ( st. success( ) ) ;
@@ -68,13 +72,8 @@ fn integration_test() {
68
72
}
69
73
70
74
match output. status . code ( ) {
71
- Some ( code) => {
72
- if code == 0 {
73
- println ! ( "Compilation successful" ) ;
74
- } else {
75
- eprintln ! ( "Compilation failed. Exit code: {}" , code) ;
76
- }
77
- } ,
75
+ Some ( 0 ) => println ! ( "Compilation successful" ) ,
76
+ Some ( code) => eprintln ! ( "Compilation failed. Exit code: {}" , code) ,
78
77
None => panic ! ( "Process terminated by signal" ) ,
79
78
}
80
79
}
0 commit comments