mirror of
https://github.com/enso-org/enso.git
synced 2024-12-23 15:12:15 +03:00
Canonicalize the temporary directory files (#8879)
Due to some Mac OS X symlinks trickery we need to canonicalize files created by `@Rule TemporaryFolder` to compare them for equality.
This commit is contained in:
parent
74b808b00d
commit
084245868d
@ -18,7 +18,7 @@ public class UtilsTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void detectParentProject() throws Exception {
|
public void detectParentProject() throws Exception {
|
||||||
var dir = folder.newFolder("dir", "prj", "src", "some", "file");
|
var dir = folder.newFolder("dir", "prj", "src", "some", "file").getCanonicalFile();
|
||||||
var prj = dir.getParentFile().getParentFile().getParentFile();
|
var prj = dir.getParentFile().getParentFile().getParentFile();
|
||||||
assertEquals("prj", prj.getName());
|
assertEquals("prj", prj.getName());
|
||||||
var yaml = new File(prj, "package.yaml");
|
var yaml = new File(prj, "package.yaml");
|
||||||
@ -35,7 +35,7 @@ public class UtilsTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void specifyProjectDir() throws Exception {
|
public void specifyProjectDir() throws Exception {
|
||||||
var dir = folder.newFolder("dir", "prj", "src", "some", "file");
|
var dir = folder.newFolder("dir", "prj", "src", "some", "file").getCanonicalFile();
|
||||||
var prj = dir.getParentFile().getParentFile().getParentFile();
|
var prj = dir.getParentFile().getParentFile().getParentFile();
|
||||||
assertEquals("prj", prj.getName());
|
assertEquals("prj", prj.getName());
|
||||||
var yaml = new File(prj, "package.yaml");
|
var yaml = new File(prj, "package.yaml");
|
||||||
@ -52,12 +52,12 @@ public class UtilsTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void specifyProjectAndFile() throws Exception {
|
public void specifyProjectAndFile() throws Exception {
|
||||||
var dir = folder.newFolder("dir", "prj", "src", "some", "file");
|
var dir = folder.newFolder("dir", "prj", "src", "some", "file").getCanonicalFile();
|
||||||
var prj = dir.getParentFile().getParentFile().getParentFile();
|
var prj = dir.getParentFile().getParentFile().getParentFile();
|
||||||
assertEquals("prj", prj.getName());
|
assertEquals("prj", prj.getName());
|
||||||
var yaml = new File(prj, "package.yaml");
|
var yaml = new File(prj, "package.yaml");
|
||||||
Files.writeString(yaml.toPath(), "enso pkg");
|
Files.writeString(yaml.toPath(), "enso pkg");
|
||||||
var src = folder.newFile("Standalone.enso");
|
var src = folder.newFile("Standalone.enso").getCanonicalFile();
|
||||||
Files.writeString(src.toPath(), "main = 42");
|
Files.writeString(src.toPath(), "main = 42");
|
||||||
|
|
||||||
var found = Utils.findFileAndProject(src.getPath(), prj.getPath());
|
var found = Utils.findFileAndProject(src.getPath(), prj.getPath());
|
||||||
@ -69,7 +69,7 @@ public class UtilsTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void dontDetectParentProjectIfMissingPackageYaml() throws Exception {
|
public void dontDetectParentProjectIfMissingPackageYaml() throws Exception {
|
||||||
var dir = folder.newFolder("dir", "prj", "src", "some", "file");
|
var dir = folder.newFolder("dir", "prj", "src", "some", "file").getCanonicalFile();
|
||||||
var prj = dir.getParentFile().getParentFile().getParentFile();
|
var prj = dir.getParentFile().getParentFile().getParentFile();
|
||||||
assertEquals("prj", prj.getName());
|
assertEquals("prj", prj.getName());
|
||||||
var yamlInWrongDir = new File(dir.getParent(), "package.yaml");
|
var yamlInWrongDir = new File(dir.getParent(), "package.yaml");
|
||||||
@ -86,7 +86,7 @@ public class UtilsTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void dontDetectParentProjectWithoutSrcDir() throws Exception {
|
public void dontDetectParentProjectWithoutSrcDir() throws Exception {
|
||||||
var dir = folder.newFolder("dir", "prj", "nosrc", "some", "file");
|
var dir = folder.newFolder("dir", "prj", "nosrc", "some", "file").getCanonicalFile();
|
||||||
var prj = dir.getParentFile().getParentFile().getParentFile();
|
var prj = dir.getParentFile().getParentFile().getParentFile();
|
||||||
assertEquals("prj", prj.getName());
|
assertEquals("prj", prj.getName());
|
||||||
var yaml = new File(prj, "package.yaml");
|
var yaml = new File(prj, "package.yaml");
|
||||||
|
Loading…
Reference in New Issue
Block a user