@@ -7,15 +7,20 @@ use snapbox::str;
77use cargo_test_support:: compare:: assert_e2e;
88use cargo_test_support:: registry:: { Package , RegistryBuilder } ;
99use cargo_test_support:: {
10- basic_bin_manifest, cargo_test, project, symlink_supported, Execs , ProjectBuilder ,
10+ basic_bin_manifest, cargo_test, project, symlink_supported, ProjectBuilder ,
1111} ;
1212
1313#[ cargo_test]
1414fn basic_lockfile_created ( ) {
1515 let lockfile_path = "mylockfile/is/burried/Cargo.lock" ;
1616 let p = make_project ( ) . build ( ) ;
1717
18- make_execs ( & mut p. cargo ( "generate-lockfile" ) , lockfile_path) . run ( ) ;
18+ p. cargo ( "generate-lockfile" )
19+ . masquerade_as_nightly_cargo ( & [ "lockfile-path" ] )
20+ . arg ( "-Zunstable-options" )
21+ . arg ( "--lockfile-path" )
22+ . arg ( lockfile_path)
23+ . run ( ) ;
1924 assert ! ( !p. root( ) . join( "Cargo.lock" ) . exists( ) ) ;
2025 assert ! ( p. root( ) . join( lockfile_path) . is_file( ) ) ;
2126}
@@ -25,7 +30,12 @@ fn basic_lockfile_read() {
2530 let lockfile_path = "mylockfile/Cargo.lock" ;
2631 let p = make_project ( ) . file ( lockfile_path, VALID_LOCKFILE ) . build ( ) ;
2732
28- make_execs ( & mut p. cargo ( "generate-lockfile" ) , lockfile_path) . run ( ) ;
33+ p. cargo ( "generate-lockfile" )
34+ . masquerade_as_nightly_cargo ( & [ "lockfile-path" ] )
35+ . arg ( "-Zunstable-options" )
36+ . arg ( "--lockfile-path" )
37+ . arg ( lockfile_path)
38+ . run ( ) ;
2939
3040 assert ! ( !p. root( ) . join( "Cargo.lock" ) . exists( ) ) ;
3141 assert ! ( p. root( ) . join( lockfile_path) . is_file( ) ) ;
@@ -38,7 +48,12 @@ fn basic_lockfile_override() {
3848 . file ( "Cargo.lock" , "This is an invalid lock file!" )
3949 . build ( ) ;
4050
41- make_execs ( & mut p. cargo ( "generate-lockfile" ) , lockfile_path) . run ( ) ;
51+ p. cargo ( "generate-lockfile" )
52+ . masquerade_as_nightly_cargo ( & [ "lockfile-path" ] )
53+ . arg ( "-Zunstable-options" )
54+ . arg ( "--lockfile-path" )
55+ . arg ( lockfile_path)
56+ . run ( ) ;
4257
4358 assert ! ( p. root( ) . join( lockfile_path) . is_file( ) ) ;
4459}
@@ -62,7 +77,12 @@ fn symlink_in_path() {
6277 fs:: create_dir ( p. root ( ) . join ( "dst" ) ) . unwrap ( ) ;
6378 assert ! ( p. root( ) . join( src) . is_dir( ) ) ;
6479
65- make_execs ( & mut p. cargo ( "generate-lockfile" ) , lockfile_path. as_str ( ) ) . run ( ) ;
80+ p. cargo ( "generate-lockfile" )
81+ . masquerade_as_nightly_cargo ( & [ "lockfile-path" ] )
82+ . arg ( "-Zunstable-options" )
83+ . arg ( "--lockfile-path" )
84+ . arg ( lockfile_path. as_str ( ) )
85+ . run ( ) ;
6686
6787 assert ! ( p. root( ) . join( lockfile_path) . is_file( ) ) ;
6888 assert ! ( p. root( ) . join( dst) . join( "Cargo.lock" ) . is_file( ) ) ;
@@ -85,7 +105,12 @@ fn symlink_lockfile() {
85105
86106 assert ! ( p. root( ) . join( src) . is_file( ) ) ;
87107
88- make_execs ( & mut p. cargo ( "generate-lockfile" ) , lockfile_path) . run ( ) ;
108+ p. cargo ( "generate-lockfile" )
109+ . masquerade_as_nightly_cargo ( & [ "lockfile-path" ] )
110+ . arg ( "-Zunstable-options" )
111+ . arg ( "--lockfile-path" )
112+ . arg ( lockfile_path)
113+ . run ( ) ;
89114
90115 assert ! ( !p. root( ) . join( "Cargo.lock" ) . exists( ) ) ;
91116}
@@ -103,7 +128,11 @@ fn broken_symlink() {
103128 let p = make_project ( ) . symlink_dir ( invalid_dst, src) . build ( ) ;
104129 assert ! ( !p. root( ) . join( src) . is_dir( ) ) ;
105130
106- make_execs ( & mut p. cargo ( "generate-lockfile" ) , lockfile_path. as_str ( ) )
131+ p. cargo ( "generate-lockfile" )
132+ . masquerade_as_nightly_cargo ( & [ "lockfile-path" ] )
133+ . arg ( "-Zunstable-options" )
134+ . arg ( "--lockfile-path" )
135+ . arg ( lockfile_path)
107136 . with_status ( 101 )
108137 . with_stderr_data ( str![ [
109138 r#"[ERROR] failed to create directory `[ROOT]/foo/somedir/link`
@@ -131,7 +160,11 @@ fn loop_symlink() {
131160 . build ( ) ;
132161 assert ! ( !p. root( ) . join( src) . is_dir( ) ) ;
133162
134- make_execs ( & mut p. cargo ( "generate-lockfile" ) , lockfile_path. as_str ( ) )
163+ p. cargo ( "generate-lockfile" )
164+ . masquerade_as_nightly_cargo ( & [ "lockfile-path" ] )
165+ . arg ( "-Zunstable-options" )
166+ . arg ( "--lockfile-path" )
167+ . arg ( lockfile_path)
135168 . with_status ( 101 )
136169 . with_stderr_data ( str![ [
137170 r#"[ERROR] failed to create directory `[ROOT]/foo/somedir/link`
@@ -158,7 +191,11 @@ fn add_lockfile_override() {
158191 let p = make_project ( )
159192 . file ( "Cargo.lock" , "This is an invalid lock file!" )
160193 . build ( ) ;
161- make_execs ( & mut p. cargo ( "add" ) , lockfile_path)
194+ p. cargo ( "add" )
195+ . masquerade_as_nightly_cargo ( & [ "lockfile-path" ] )
196+ . arg ( "-Zunstable-options" )
197+ . arg ( "--lockfile-path" )
198+ . arg ( lockfile_path)
162199 . arg ( "--path" )
163200 . arg ( "../bar" )
164201 . run ( ) ;
@@ -172,7 +209,11 @@ fn clean_lockfile_override() {
172209 let p = make_project ( )
173210 . file ( "Cargo.lock" , "This is an invalid lock file!" )
174211 . build ( ) ;
175- make_execs ( & mut p. cargo ( "clean" ) , lockfile_path)
212+ p. cargo ( "clean" )
213+ . masquerade_as_nightly_cargo ( & [ "lockfile-path" ] )
214+ . arg ( "-Zunstable-options" )
215+ . arg ( "--lockfile-path" )
216+ . arg ( lockfile_path)
176217 . arg ( "--package" )
177218 . arg ( "test_foo" )
178219 . run ( ) ;
@@ -186,7 +227,11 @@ fn fix_lockfile_override() {
186227 let p = make_project ( )
187228 . file ( "Cargo.lock" , "This is an invalid lock file!" )
188229 . build ( ) ;
189- make_execs ( & mut p. cargo ( "fix" ) , lockfile_path)
230+ p. cargo ( "fix" )
231+ . masquerade_as_nightly_cargo ( & [ "lockfile-path" ] )
232+ . arg ( "-Zunstable-options" )
233+ . arg ( "--lockfile-path" )
234+ . arg ( lockfile_path)
190235 . arg ( "--package" )
191236 . arg ( "test_foo" )
192237 . arg ( "--allow-no-vcs" )
@@ -201,7 +246,11 @@ fn publish_lockfile_read() {
201246 let p = make_project ( ) . file ( lockfile_path, VALID_LOCKFILE ) . build ( ) ;
202247 let registry = RegistryBuilder :: new ( ) . http_api ( ) . http_index ( ) . build ( ) ;
203248
204- make_execs ( & mut p. cargo ( "publish" ) , lockfile_path)
249+ p. cargo ( "publish" )
250+ . masquerade_as_nightly_cargo ( & [ "lockfile-path" ] )
251+ . arg ( "-Zunstable-options" )
252+ . arg ( "--lockfile-path" )
253+ . arg ( lockfile_path)
205254 . replace_crates_io ( registry. index_url ( ) )
206255 . run ( ) ;
207256
@@ -239,7 +288,11 @@ fn remove_lockfile_override() {
239288 . file ( "src/main.rs" , "fn main() {}" )
240289 . file ( "Cargo.lock" , "This is an invalid lock file!" )
241290 . build ( ) ;
242- make_execs ( & mut p. cargo ( "remove" ) , lockfile_path)
291+ p. cargo ( "remove" )
292+ . masquerade_as_nightly_cargo ( & [ "lockfile-path" ] )
293+ . arg ( "-Zunstable-options" )
294+ . arg ( "--lockfile-path" )
295+ . arg ( lockfile_path)
243296 . arg ( "test_bar" )
244297 . run ( ) ;
245298
@@ -272,15 +325,25 @@ bar = "0.1.0"
272325 . build ( ) ;
273326
274327 Package :: new ( "bar" , "0.1.0" ) . publish ( ) ;
275- make_execs ( & mut p. cargo ( "generate-lockfile" ) , lockfile_path) . run ( ) ;
328+ p. cargo ( "generate-lockfile" )
329+ . masquerade_as_nightly_cargo ( & [ "lockfile-path" ] )
330+ . arg ( "-Zunstable-options" )
331+ . arg ( "--lockfile-path" )
332+ . arg ( lockfile_path)
333+ . run ( ) ;
276334
277335 assert ! ( !p. root( ) . join( "Cargo.lock" ) . exists( ) ) ;
278336 assert ! ( p. root( ) . join( lockfile_path) . is_file( ) ) ;
279337
280338 let lockfile_original = fs:: read_to_string ( p. root ( ) . join ( lockfile_path) ) . unwrap ( ) ;
281339
282340 Package :: new ( "bar" , "0.1.1" ) . publish ( ) ;
283- make_execs ( & mut p. cargo ( "package" ) , lockfile_path) . run ( ) ;
341+ p. cargo ( "package" )
342+ . masquerade_as_nightly_cargo ( & [ "lockfile-path" ] )
343+ . arg ( "-Zunstable-options" )
344+ . arg ( "--lockfile-path" )
345+ . arg ( lockfile_path)
346+ . run ( ) ;
284347
285348 assert ! ( p
286349 . root( )
@@ -353,11 +416,3 @@ fn make_project() -> ProjectBuilder {
353416 . file ( "Cargo.toml" , & basic_bin_manifest ( "test_foo" ) )
354417 . file ( "src/main.rs" , "fn main() {}" )
355418}
356-
357- fn make_execs < ' a > ( execs : & ' a mut Execs , lockfile_path_argument : & str ) -> & ' a mut Execs {
358- execs
359- . masquerade_as_nightly_cargo ( & [ "lockfile-path" ] )
360- . arg ( "-Zunstable-options" )
361- . arg ( "--lockfile-path" )
362- . arg ( lockfile_path_argument)
363- }
0 commit comments