From fa8fd7f48a270a3e24cff3c2de4b94eecdbf49d2 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Tue, 24 Sep 2024 10:22:44 -0500 Subject: [PATCH] test(script): Show autolib bug from #14476 --- tests/testsuite/script.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/testsuite/script.rs b/tests/testsuite/script.rs index 6cf34b4e4d5..5a6030609ad 100644 --- a/tests/testsuite/script.rs +++ b/tests/testsuite/script.rs @@ -813,6 +813,31 @@ Hello world! .run(); } +#[cargo_test] +fn test_no_autolib() { + let script = r#"#!/usr/bin/env cargo + +fn main() { + println!("Hello world!"); +}"#; + let p = cargo_test_support::project() + .file("script.rs", script) + .file("src/lib.rs", r#"compile_error!{"must not be built"}"#) + .build(); + + p.cargo("-Zscript -v script.rs --help") + .masquerade_as_nightly_cargo(&["script"]) + .with_status(101) + .with_stdout_data(str![""]) + .with_stderr_data(str![[r#" +... +[..]compile_error!{"must not be built"}[..] +... + +"#]]) + .run(); +} + #[cargo_test] fn implicit_target_dir() { let script = ECHO_SCRIPT;