-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Warn on Windows about reserved target names.
- Loading branch information
Showing
3 changed files
with
54 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//! Tests specifically related to target handling (lib, bins, examples, tests, benches). | ||
|
||
use cargo_test_support::project; | ||
|
||
#[cargo_test] | ||
fn reserved_windows_target_name() { | ||
let p = project() | ||
.file( | ||
"Cargo.toml", | ||
r#" | ||
[package] | ||
name = "foo" | ||
version = "0.1.0" | ||
[[bin]] | ||
name = "con" | ||
path = "src/main.rs" | ||
"#, | ||
) | ||
.file("src/main.rs", "fn main() {}") | ||
.build(); | ||
|
||
if cfg!(windows) { | ||
p.cargo("check") | ||
.with_stderr( | ||
"\ | ||
[WARNING] binary target `con` is a reserved Windows filename, \ | ||
this target will not work on Windows platforms | ||
[CHECKING] foo[..] | ||
[FINISHED][..] | ||
", | ||
) | ||
.run(); | ||
} else { | ||
p.cargo("check") | ||
.with_stderr("[CHECKING] foo[..]\n[FINISHED][..]") | ||
.run(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters