mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
test(rustdocflags): shouldn't be affected by rustflags from target.cfg
This commit is contained in:
parent
da204963d6
commit
f8d1b30ad3
@ -122,3 +122,35 @@ fn whitespace() {
|
||||
let contents = p.read_file("target/doc/foo/index.html");
|
||||
assert!(contents.contains(SPACED_VERSION));
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn not_affected_by_target_rustflags() {
|
||||
let cfg = if cfg!(windows) { "windows" } else { "unix" };
|
||||
let p = project()
|
||||
.file("src/lib.rs", "")
|
||||
.file(
|
||||
".cargo/config",
|
||||
&format!(
|
||||
r#"
|
||||
[target.'cfg({cfg})']
|
||||
rustflags = ["-D", "missing-docs"]
|
||||
|
||||
[build]
|
||||
rustdocflags = ["--cfg", "foo"]
|
||||
"#,
|
||||
),
|
||||
)
|
||||
.build();
|
||||
|
||||
// `cargo build` should fail due to missing docs.
|
||||
p.cargo("build -v")
|
||||
.with_status(101)
|
||||
.with_stderr_contains("[RUNNING] `rustc [..] -D missing-docs[..]`")
|
||||
.run();
|
||||
|
||||
// This is wrong behaviour. `cargo doc` shouldn't fail.
|
||||
p.cargo("doc -v")
|
||||
.with_status(101)
|
||||
.with_stderr_contains("[RUNNING] `rustdoc [..] -D missing-docs[..]`")
|
||||
.run();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user