mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
Add tests for warning on misspelled env vars
This commit is contained in:
parent
d17ccec2e8
commit
44aec50e4e
@ -85,3 +85,13 @@ fn rustdocflags_passed_to_rustdoc_through_cargo_test_only_once() {
|
||||
.env("RUSTDOCFLAGS", "--markdown-no-toc")
|
||||
.run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rustdocflags_misspelled() {
|
||||
let p = project().file("src/main.rs", "fn main() { }").build();
|
||||
|
||||
p.cargo("doc")
|
||||
.env("RUSTDOC_FLAGS", "foo")
|
||||
.with_stderr_contains("[WARNING] Cargo does not read `RUSTDOC_FLAGS` environment variable. Did you mean `RUSTDOCFLAGS`?")
|
||||
.run();
|
||||
}
|
||||
|
@ -1325,3 +1325,37 @@ fn two_matching_in_config() {
|
||||
p1.cargo("run").run();
|
||||
p1.cargo("build").with_stderr("[FINISHED] [..]").run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn env_rustflags_misspelled() {
|
||||
let p = project().file("src/main.rs", "fn main() { }").build();
|
||||
|
||||
for cmd in &["check", "build", "run", "test", "bench"] {
|
||||
p.cargo(cmd)
|
||||
.env("RUST_FLAGS", "foo")
|
||||
.with_stderr_contains("[WARNING] Cargo does not read `RUST_FLAGS` environment variable. Did you mean `RUSTFLAGS`?")
|
||||
.run();
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn env_rustflags_misspelled_build_script() {
|
||||
let p = project()
|
||||
.file(
|
||||
"Cargo.toml",
|
||||
r#"
|
||||
[package]
|
||||
name = "foo"
|
||||
version = "0.0.1"
|
||||
build = "build.rs"
|
||||
"#,
|
||||
)
|
||||
.file("src/lib.rs", "")
|
||||
.file("build.rs", "fn main() { }")
|
||||
.build();
|
||||
|
||||
p.cargo("build")
|
||||
.env("RUST_FLAGS", "foo")
|
||||
.with_stderr_contains("[WARNING] Cargo does not read `RUST_FLAGS` environment variable. Did you mean `RUSTFLAGS`?")
|
||||
.run();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user