Skip to content
This repository was archived by the owner on Nov 24, 2023. It is now read-only.

Commit 379fabd

Browse files
committed
Add test for setting RUSTFLAGS
1 parent e3608da commit 379fabd

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

cargo-fix/tests/all/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ mod broken_build;
356356
mod broken_lints;
357357
mod dependencies;
358358
mod edition_upgrade;
359+
mod rust_flags;
359360
mod smoke;
360361
mod subtargets;
361362
mod vcs;

cargo-fix/tests/all/rust_flags.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
use super::project;
2+
3+
#[test]
4+
fn specify_rustflags() {
5+
let p = project()
6+
.file(
7+
"src/lib.rs",
8+
r#"
9+
#![allow(unused)]
10+
#![feature(rust_2018_preview)]
11+
12+
mod foo {
13+
pub const FOO: &str = "fooo";
14+
}
15+
16+
fn main() {
17+
let x = ::foo::FOO;
18+
}
19+
"#,
20+
)
21+
.build();
22+
23+
let stderr = "\
24+
[CHECKING] foo v0.1.0 (CWD)
25+
[FIXING] src/lib.rs (1 fix)
26+
[FINISHED] dev [unoptimized + debuginfo]
27+
";
28+
29+
p.expect_cmd("cargo-fix fix --prepare-for 2018")
30+
.env("RUSTFLAGS", "-C target-cpu=native")
31+
.stdout("")
32+
.stderr(stderr)
33+
.run();
34+
}

0 commit comments

Comments
 (0)