Skip to content

Commit

Permalink
Add regression test for #10206
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Gjengset committed Feb 18, 2022
1 parent 040f0d1 commit fb47df7
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/testsuite/rustflags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1435,3 +1435,21 @@ fn remap_path_prefix_works() {
.with_stdout("/foo/home/.cargo/registry/src/[..]/bar-0.1.0/src/lib.rs")
.run();
}

#[cargo_test]
fn host_config_rustflags_with_target() {
// regression test for https://github.com/rust-lang/cargo/issues/10206
let p = project()
.file("src/lib.rs", "")
.file("build.rs.rs", "fn main() { assert!(cfg!(foo)); }")
.build();

p.cargo("build")
.masquerade_as_nightly_cargo()
.arg("-Zhost-config")
.arg("-Ztarget-applies-to-host=no")
.arg("-Zunstable-options")
.arg("--config")
.arg("host.rustflags=[\"--cfg=foo\"]")
.run();
}

0 comments on commit fb47df7

Please sign in to comment.