Skip to content

Commit 6139264

Browse files
test: ensure clang --driver-mode=cl is MSVC- and clang-cl-like
1 parent f872c9f commit 6139264

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/cc_env.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ fn main() {
1515
extra_flags();
1616
path_to_ccache();
1717
more_spaces();
18+
clang_cl();
1819
}
1920

2021
fn ccache() {
@@ -110,3 +111,18 @@ fn more_spaces() {
110111
let compiler = test.gcc().file("foo.c").get_compiler();
111112
assert_eq!(compiler.path(), Path::new("cc"));
112113
}
114+
115+
fn clang_cl() {
116+
for exe_suffix in ["", ".exe"] {
117+
let test = Test::clang();
118+
let bin = format!("clang{exe_suffix}");
119+
env::set_var("CC", &format!("{bin} --driver-mode=cl"));
120+
let test_compiler = |build: cc::Build| {
121+
let compiler = build.get_compiler();
122+
assert_eq!(compiler.path(), Path::new(&*bin));
123+
assert!(compiler.is_like_msvc());
124+
assert!(compiler.is_like_clang_cl());
125+
};
126+
test_compiler(test.gcc());
127+
}
128+
}

0 commit comments

Comments
 (0)