Skip to content

Commit

Permalink
Added another test.
Browse files Browse the repository at this point in the history
  • Loading branch information
torhovland committed May 7, 2024
1 parent 71ee2c9 commit e4e6261
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions tests/testsuite/build_script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
",
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit e4e6261

Please sign in to comment.