Skip to content

Commit 9d85c89

Browse files
committed
test(script): Verify existing config behavior
1 parent bda23fc commit 9d85c89

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

tests/testsuite/script.rs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,48 @@ fn main() {
332332
.run();
333333
}
334334

335+
#[cargo_test]
336+
fn use_script_config() {
337+
let script = ECHO_SCRIPT;
338+
let _ = cargo_test_support::project()
339+
.at("script")
340+
.file("script.rs", script)
341+
.build();
342+
343+
let p = cargo_test_support::project()
344+
.file(
345+
".cargo/config",
346+
r#"
347+
[build]
348+
rustc = "non-existent-rustc"
349+
"#,
350+
)
351+
.file("script.rs", script)
352+
.build();
353+
354+
// Verify the config is bad
355+
p.cargo("-Zscript script.rs")
356+
.masquerade_as_nightly_cargo(&["script"])
357+
.with_status(101)
358+
.with_stderr_contains(
359+
"\
360+
[ERROR] could not execute process `non-existent-rustc -vV` (never executed)
361+
",
362+
)
363+
.run();
364+
365+
// Verify that the config is still used
366+
p.cargo("-Zscript ../script/script.rs")
367+
.masquerade_as_nightly_cargo(&["script"])
368+
.with_status(101)
369+
.with_stderr_contains(
370+
"\
371+
[ERROR] could not execute process `non-existent-rustc -vV` (never executed)
372+
",
373+
)
374+
.run();
375+
}
376+
335377
#[cargo_test]
336378
fn test_line_numbering_preserved() {
337379
let script = r#"#!/usr/bin/env cargo

0 commit comments

Comments
 (0)