Skip to content

Commit 4aac847

Browse files
committed
Added test.
1 parent 2607f6d commit 4aac847

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

tests/testsuite/build_script.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5508,6 +5508,47 @@ for more information about build script outputs.
55085508
.run();
55095509
}
55105510

5511+
#[cargo_test]
5512+
fn test_new_syntax_with_old_msrv_and_reserved_prefix() {
5513+
let p = project()
5514+
.file(
5515+
"Cargo.toml",
5516+
r#"
5517+
[package]
5518+
name = "foo"
5519+
version = "0.5.0"
5520+
edition = "2015"
5521+
authors = []
5522+
build = "build.rs"
5523+
rust-version = "1.60.0"
5524+
"#,
5525+
)
5526+
.file("src/lib.rs", "")
5527+
.file(
5528+
"build.rs",
5529+
r#"
5530+
fn main() {
5531+
println!("cargo::rustc-check-cfg=cfg(foo)");
5532+
}
5533+
"#,
5534+
)
5535+
.build();
5536+
5537+
p.cargo("build")
5538+
.with_status(101)
5539+
.with_stderr_contains(
5540+
"\
5541+
[COMPILING] foo [..]
5542+
error: the `cargo::` syntax for build script output instructions was added in Rust 1.77.0, \
5543+
but the minimum supported Rust version of `foo v0.5.0 ([ROOT]/foo)` is 1.60.0.
5544+
Consider using the old `cargo:` syntax in front of `rustc-check-cfg=`.
5545+
See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script \
5546+
for more information about build script outputs.
5547+
",
5548+
)
5549+
.run();
5550+
}
5551+
55115552
#[cargo_test]
55125553
fn test_new_syntax_with_compatible_partial_msrv() {
55135554
let p = project()

0 commit comments

Comments
 (0)