From: Ben Soares Date: Wed, 12 Apr 2023 13:41:23 +0000 (+0100) Subject: JAL-629 Fixed ~ based test for build server X-Git-Tag: Release_2_11_4_0~395 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=82927e58aa86abee1ab11da889cabbebb18e90ad;p=jalview.git JAL-629 Fixed ~ based test for build server --- diff --git a/test/jalview/util/FileUtilsTest.java b/test/jalview/util/FileUtilsTest.java index d49fd4c..79c703f 100644 --- a/test/jalview/util/FileUtilsTest.java +++ b/test/jalview/util/FileUtilsTest.java @@ -21,6 +21,7 @@ package jalview.util; import java.io.File; +import java.io.IOException; import java.util.List; import org.testng.Assert; @@ -67,7 +68,7 @@ public class FileUtilsTest else if (where < 0) Assert.assertTrue(d.startsWith(dirname), "getDirname(" + file.getPath() + ")=" + d - + " didn't start with '" + d + "'"); + + " didn't start with '" + dirname + "'"); else if (where > 0) Assert.assertTrue(d.endsWith(dirname), "getDirname(" + file.getPath() + ")=" + d + " didn't end with '" + d + "'"); @@ -100,9 +101,18 @@ public class FileUtilsTest @DataProvider(name = "dirnamesAndBasenames") public Object[][] dirnamesAndBasenames() { + String homeDir = null; + try + { + homeDir = new File(System.getProperty("user.home")) + .getCanonicalPath(); + } catch (IOException e) + { + System.err.println("Problem getting canonical home dir"); + e.printStackTrace(); + } return new Object[][] { // -1=startsWith, 0=equals, 1=endsWith - { "~/hello/sailor", -1, System.getProperty("user.home"), "sailor", - "~" }, // + { "~/hello/sailor", -1, homeDir, "sailor", "~" }, // { "~/hello/sailor", 1, "/hello", "sailor", "~" }, // { "./examples/uniref50.fa", -1, "/", "uniref50", null }, // { "./examples/uniref50.fa", 1, "/examples", "uniref50", null }, //