Skip to content

Commit

Permalink
Fix SymbolicLinkPreservingTarIT on windows (#46908)
Browse files Browse the repository at this point in the history
  • Loading branch information
alpar-t committed Sep 20, 2019
1 parent d2c4b3e commit d54f90b
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.nio.file.Path;
import java.nio.file.Paths;

import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.equalTo;

public class SymbolicLinkPreservingTarIT extends GradleIntegrationTestCase {
Expand Down Expand Up @@ -92,18 +93,27 @@ private void assertTar(
fileEntry = true;
} else if (entry.getName().equals("real-folder/link-to-file")) {
assertTrue(entry.isSymbolicLink());
assertThat(entry.getLinkName(), equalTo("./file"));
assertThat(
entry.getLinkName(),
anyOf(equalTo("./file"), equalTo(".\\file"))
);
linkToFileEntry = true;
} else if (entry.getName().equals("link-in-folder/")) {
assertTrue(entry.isDirectory());
linkInFolderEntry = true;
} else if (entry.getName().equals("link-in-folder/link-to-file")) {
assertTrue(entry.isSymbolicLink());
assertThat(entry.getLinkName(), equalTo("../real-folder/file"));
assertThat(
entry.getLinkName(),
anyOf(equalTo("../real-folder/file"), equalTo("..\\real-folder\\file"))
);
linkInFolderLinkToFileEntry = true;
} else if (entry.getName().equals("link-to-real-folder")) {
assertTrue(entry.isSymbolicLink());
assertThat(entry.getLinkName(), equalTo("./real-folder"));
assertThat(
entry.getLinkName(),
anyOf(equalTo("./real-folder"), equalTo(".\\real-folder"))
);
linkToRealFolderEntry = true;
} else {
throw new GradleException("unexpected entry [" + entry.getName() + "]");
Expand Down

0 comments on commit d54f90b

Please sign in to comment.