Fix Windows symlink test to give reproducible error messages

After a `git clone -c core.symlinks=false` and `cargo test`, the script outputs a Git error as expected.
When running `cargo test` again, the error message changes to "symlink support needs to be enabled".

The test is done for an already existing directory, and the Windows mklink command _fails_ when the symlink exists already.
This commit deletes the link prior to the symlink creation.
This commit is contained in:
Jan Haller 2020-10-13 22:48:08 +02:00
parent e35673d7de
commit 595ac27632

View File

@ -61,6 +61,7 @@ fn main() {
let from_dir = parent_dir.join("from");
let to_dir = parent_dir.join("to");
if fs::create_dir_all(&from_dir).is_ok()
&& fs::remove_dir(&to_dir).is_ok()
&& windows::symlink_dir(&from_dir, &to_dir).is_err()
{
message = DENIED;