mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
test: target.triple.rustdocflags
works for doctest
This commit is contained in:
parent
ef39572305
commit
6131e991af
@ -184,3 +184,49 @@ fn target_triple_rustdocflags_works() {
|
||||
.with_stderr_contains("[RUNNING] `rustdoc[..]--cfg[..]foo[..]`")
|
||||
.run();
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn target_triple_rustdocflags_works_through_cargo_test() {
|
||||
let host = rustc_host();
|
||||
let host_env = rustc_host_env();
|
||||
let p = project()
|
||||
.file(
|
||||
"src/lib.rs",
|
||||
r#"
|
||||
//! ```
|
||||
//! assert!(cfg!(foo));
|
||||
//! ```
|
||||
"#,
|
||||
)
|
||||
.build();
|
||||
|
||||
// target.triple.rustdocflags in env works
|
||||
p.cargo("test --doc -v")
|
||||
.env(
|
||||
&format!("CARGO_TARGET_{host_env}_RUSTDOCFLAGS"),
|
||||
"--cfg=foo",
|
||||
)
|
||||
.with_stderr_contains("[RUNNING] `rustdoc[..]--test[..]--cfg[..]foo[..]`")
|
||||
.with_stdout_contains(
|
||||
"\
|
||||
running 1 test
|
||||
test src/lib.rs - (line 2) ... ok
|
||||
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out[..]",
|
||||
)
|
||||
.run();
|
||||
|
||||
// target.triple.rustdocflags in config works
|
||||
p.cargo("test --doc -v")
|
||||
.arg("--config")
|
||||
.arg(format!("target.{host}.rustdocflags=['--cfg', 'foo']"))
|
||||
.with_stderr_contains("[RUNNING] `rustdoc[..]--test[..]--cfg[..]foo[..]`")
|
||||
.with_stdout_contains(
|
||||
"\
|
||||
running 1 test
|
||||
test src/lib.rs - (line 2) ... ok
|
||||
|
||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out[..]",
|
||||
)
|
||||
.run();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user