Skip to content

Commit

Permalink
Add unit test for extensionless Windows executable
Browse files Browse the repository at this point in the history
  • Loading branch information
Xaeroxe committed Oct 17, 2023
1 parent 323155d commit 6a027d1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,3 +449,20 @@ fn test_failure() {

let _ = run();
}

#[test]
#[cfg(windows)]
fn windows_no_extension_but_executable() {
let this_executable = PathBuf::from(std::env::args().next().unwrap());
let new_name = this_executable.parent().unwrap().join("test_executable");
std::fs::copy(&this_executable, &new_name).unwrap();
let found_executable = which::which_in_global(
new_name.file_name().unwrap(),
Some(this_executable.parent().unwrap()),
)
.unwrap()
.next()
.unwrap();
assert_eq!(found_executable, new_name);
std::fs::remove_file(new_name).unwrap();
}

0 comments on commit 6a027d1

Please sign in to comment.