Skip to content

Commit ff0453b

Browse files
committed
Added another test.
1 parent 4b49826 commit ff0453b

File tree

1 file changed

+51
-10
lines changed

1 file changed

+51
-10
lines changed

tests/testsuite/build_script.rs

Lines changed: 51 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ fn custom_build_invalid_host_config_feature_flag() {
625625
.with_status(101)
626626
.with_stderr_contains(
627627
"\
628-
error: the -Zhost-config flag requires the -Ztarget-applies-to-host flag to be set
628+
[ERROR] the -Zhost-config flag requires the -Ztarget-applies-to-host flag to be set
629629
",
630630
)
631631
.run();
@@ -1038,7 +1038,7 @@ fn links_duplicates() {
10381038

10391039
p.cargo("build").with_status(101)
10401040
.with_stderr("\
1041-
error: failed to select a version for `a-sys`.
1041+
[ERROR] failed to select a version for `a-sys`.
10421042
... required by package `foo v0.5.0 ([..])`
10431043
versions that meet the requirements `*` are: 0.5.0
10441044
@@ -1163,7 +1163,7 @@ fn links_duplicates_deep_dependency() {
11631163

11641164
p.cargo("build").with_status(101)
11651165
.with_stderr("\
1166-
error: failed to select a version for `a-sys`.
1166+
[ERROR] failed to select a version for `a-sys`.
11671167
... required by package `a v0.5.0 ([..])`
11681168
... which satisfies path dependency `a` of package `foo v0.5.0 ([..])`
11691169
versions that meet the requirements `*` are: 0.5.0
@@ -4508,7 +4508,7 @@ fn links_duplicates_with_cycle() {
45084508

45094509
p.cargo("build").with_status(101)
45104510
.with_stderr("\
4511-
error: failed to select a version for `a`.
4511+
[ERROR] failed to select a version for `a`.
45124512
... required by package `foo v0.5.0 ([..])`
45134513
versions that meet the requirements `*` are: 0.5.0
45144514
@@ -5315,7 +5315,7 @@ fn wrong_output() {
53155315
.with_stderr(
53165316
"\
53175317
[COMPILING] foo [..]
5318-
error: invalid output in build script of `foo v0.0.1 ([ROOT]/foo)`: `cargo::example`
5318+
[ERROR] invalid output in build script of `foo v0.0.1 ([ROOT]/foo)`: `cargo::example`
53195319
Expected a line with `cargo::KEY=VALUE` with an `=` character, but none was found.
53205320
See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script \
53215321
for more information about build script outputs.
@@ -5405,7 +5405,7 @@ fn test_invalid_old_syntax() {
54055405
.with_stderr(
54065406
"\
54075407
[COMPILING] foo [..]
5408-
error: invalid output in build script of `foo v0.0.1 ([ROOT]/foo)`: `cargo:foo`
5408+
[ERROR] invalid output in build script of `foo v0.0.1 ([ROOT]/foo)`: `cargo:foo`
54095409
Expected a line with `cargo:KEY=VALUE` with an `=` character, but none was found.
54105410
See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script \
54115411
for more information about build script outputs.
@@ -5434,7 +5434,7 @@ fn test_invalid_new_syntax() {
54345434
.with_stderr(
54355435
"\
54365436
[COMPILING] foo [..]
5437-
error: invalid output in build script of `foo v0.0.1 ([ROOT]/foo)`: `cargo::metadata=foo`
5437+
[ERROR] invalid output in build script of `foo v0.0.1 ([ROOT]/foo)`: `cargo::metadata=foo`
54385438
Expected a line with `cargo::metadata=KEY=VALUE` with an `=` character, but none was found.
54395439
See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script \
54405440
for more information about build script outputs.
@@ -5459,7 +5459,7 @@ for more information about build script outputs.
54595459
.with_stderr(
54605460
"\
54615461
[COMPILING] foo [..]
5462-
error: invalid output in build script of `foo v0.0.1 ([ROOT]/foo)`: `cargo::foo=bar`
5462+
[ERROR] invalid output in build script of `foo v0.0.1 ([ROOT]/foo)`: `cargo::foo=bar`
54635463
Unknown key: `foo`.
54645464
See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script \
54655465
for more information about build script outputs.
@@ -5499,8 +5499,9 @@ fn test_new_syntax_with_old_msrv() {
54995499
.with_stderr_contains(
55005500
"\
55015501
[COMPILING] foo [..]
5502-
error: the `cargo::` syntax for build script output instructions was added in Rust 1.77.0, \
5502+
[ERROR] the `cargo::` syntax for build script output instructions was added in Rust 1.77.0, \
55035503
but the minimum supported Rust version of `foo v0.5.0 ([ROOT]/foo)` is 1.60.0.
5504+
Consider using the old `cargo:foo=bar` syntax instead of `cargo::metadata=foo=bar` (note the single colon).
55045505
See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script \
55055506
for more information about build script outputs.
55065507
",
@@ -5539,7 +5540,7 @@ fn test_new_syntax_with_old_msrv_and_reserved_prefix() {
55395540
.with_stderr_contains(
55405541
"\
55415542
[COMPILING] foo [..]
5542-
error: the `cargo::` syntax for build script output instructions was added in Rust 1.77.0, \
5543+
[ERROR] the `cargo::` syntax for build script output instructions was added in Rust 1.77.0, \
55435544
but the minimum supported Rust version of `foo v0.5.0 ([ROOT]/foo)` is 1.60.0.
55445545
Consider using the old `cargo:` syntax in front of `rustc-check-cfg=cfg(foo)`.
55455546
See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script \
@@ -5549,6 +5550,46 @@ for more information about build script outputs.
55495550
.run();
55505551
}
55515552

5553+
#[cargo_test]
5554+
fn test_new_syntax_with_old_msrv_and_unknown_prefix() {
5555+
let p = project()
5556+
.file(
5557+
"Cargo.toml",
5558+
r#"
5559+
[package]
5560+
name = "foo"
5561+
version = "0.5.0"
5562+
edition = "2015"
5563+
authors = []
5564+
build = "build.rs"
5565+
rust-version = "1.60.0"
5566+
"#,
5567+
)
5568+
.file("src/lib.rs", "")
5569+
.file(
5570+
"build.rs",
5571+
r#"
5572+
fn main() {
5573+
println!("cargo::foo=bar");
5574+
}
5575+
"#,
5576+
)
5577+
.build();
5578+
5579+
p.cargo("build")
5580+
.with_status(101)
5581+
.with_stderr_contains(
5582+
"\
5583+
[COMPILING] foo [..]
5584+
[ERROR] the `cargo::` syntax for build script output instructions was added in Rust 1.77.0, \
5585+
but the minimum supported Rust version of `foo v0.5.0 ([ROOT]/foo)` is 1.60.0.
5586+
See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script \
5587+
for more information about build script outputs.
5588+
",
5589+
)
5590+
.run();
5591+
}
5592+
55525593
#[cargo_test]
55535594
fn test_new_syntax_with_compatible_partial_msrv() {
55545595
let p = project()

0 commit comments

Comments
 (0)