1
+ use std:: fs;
2
+
1
3
use cargo_test_support:: basic_manifest;
4
+ use cargo_test_support:: paths:: cargo_home;
2
5
use cargo_test_support:: prelude:: * ;
3
6
use cargo_test_support:: registry:: Package ;
4
7
use cargo_test_support:: str;
@@ -318,7 +321,28 @@ rustc = "non-existent-rustc"
318
321
. file ( "script.rs" , script)
319
322
. build ( ) ;
320
323
321
- // Verify the config is bad
324
+ // Verify that the local config is not used
325
+ p. cargo ( "-Zscript ../script/script.rs -NotAnArg" )
326
+ . masquerade_as_nightly_cargo ( & [ "script" ] )
327
+ . with_stdout_data ( str![ [ r#"
328
+ bin: [ROOT]/home/.cargo/target/[HASH]/debug/script[EXE]
329
+ args: ["-NotAnArg"]
330
+
331
+ "# ] ] )
332
+ . run ( ) ;
333
+
334
+ // Write a global config.toml in the cargo home directory
335
+ let cargo_home = cargo_home ( ) ;
336
+ fs:: write (
337
+ & cargo_home. join ( "config.toml" ) ,
338
+ r#"
339
+ [build]
340
+ rustc = "non-existent-rustc"
341
+ "# ,
342
+ )
343
+ . unwrap ( ) ;
344
+
345
+ // Verify the global config is used
322
346
p. cargo ( "-Zscript script.rs -NotAnArg" )
323
347
. masquerade_as_nightly_cargo ( & [ "script" ] )
324
348
. with_status ( 101 )
@@ -328,16 +352,6 @@ rustc = "non-existent-rustc"
328
352
Caused by:
329
353
[NOT_FOUND]
330
354
331
- "# ] ] )
332
- . run ( ) ;
333
-
334
- // Verify that the config isn't used
335
- p. cargo ( "-Zscript ../script/script.rs -NotAnArg" )
336
- . masquerade_as_nightly_cargo ( & [ "script" ] )
337
- . with_stdout_data ( str![ [ r#"
338
- bin: [ROOT]/home/.cargo/target/[HASH]/debug/script[EXE]
339
- args: ["-NotAnArg"]
340
-
341
355
"# ] ] )
342
356
. run ( ) ;
343
357
}
0 commit comments