From e4e6261ca177f74c41718dc22fca6942635e24b1 Mon Sep 17 00:00:00 2001 From: Tor Hovland <55164+torhovland@users.noreply.github.com> Date: Tue, 7 May 2024 12:40:40 +0200 Subject: [PATCH] Added another test. --- tests/testsuite/build_script.rs | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/testsuite/build_script.rs b/tests/testsuite/build_script.rs index 64026f2c7e61..6ad31ec72c1e 100644 --- a/tests/testsuite/build_script.rs +++ b/tests/testsuite/build_script.rs @@ -5501,6 +5501,7 @@ fn test_new_syntax_with_old_msrv() { [COMPILING] foo [..] error: the `cargo::` syntax for build script output instructions was added in Rust 1.77.0, \ but the minimum supported Rust version of `foo v0.5.0 ([ROOT]/foo)` is 1.60.0. +Consider using the old `cargo:foo=bar` syntax instead of `cargo::metadata=foo=bar` (note the single colon). See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script \ for more information about build script outputs. ", @@ -5549,6 +5550,46 @@ for more information about build script outputs. .run(); } +#[cargo_test] +fn test_new_syntax_with_old_msrv_and_unknown_prefix() { + let p = project() + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + version = "0.5.0" + edition = "2015" + authors = [] + build = "build.rs" + rust-version = "1.60.0" + "#, + ) + .file("src/lib.rs", "") + .file( + "build.rs", + r#" + fn main() { + println!("cargo::foo=bar"); + } + "#, + ) + .build(); + + p.cargo("build") + .with_status(101) + .with_stderr_contains( + "\ +[COMPILING] foo [..] +error: the `cargo::` syntax for build script output instructions was added in Rust 1.77.0, \ +but the minimum supported Rust version of `foo v0.5.0 ([ROOT]/foo)` is 1.60.0. +See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script \ +for more information about build script outputs. +", + ) + .run(); +} + #[cargo_test] fn test_new_syntax_with_compatible_partial_msrv() { let p = project()