Skip to content

Commit 4427cfe

Browse files
committed
test(script): Verify existing build.rs behavior
1 parent 0d5370a commit 4427cfe

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/testsuite/script.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,30 @@ fn main() {
509509
.run();
510510
}
511511

512+
#[cargo_test]
513+
fn test_no_build_rs() {
514+
let script = r#"#!/usr/bin/env cargo
515+
516+
fn main() {
517+
println!("Hello world!");
518+
}"#;
519+
let p = cargo_test_support::project()
520+
.file("script.rs", script)
521+
.file("build.rs", "broken")
522+
.build();
523+
524+
p.cargo("-Zscript script.rs --help")
525+
.masquerade_as_nightly_cargo(&["script"])
526+
.with_status(101)
527+
.with_stdout(r#""#)
528+
.with_stderr_contains(
529+
"\
530+
[ERROR] could not compile `script` (build script) due to previous error
531+
",
532+
)
533+
.run();
534+
}
535+
512536
#[cargo_test]
513537
fn test_no_autobins() {
514538
let script = r#"#!/usr/bin/env cargo

0 commit comments

Comments
 (0)