Skip to content

Commit 55b7932

Browse files
committed
ScriptServiceTest: (hopefully) fix test on Windows
On Windows, the path separator is backslash instead of slash. So let's be agnostic about constructing our path names that way.
1 parent e0c9da6 commit 55b7932

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/test/java/org/scijava/script/ScriptServiceTest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ public class ScriptServiceTest {
5252
*/
5353
@Test
5454
public void testSystemProperty() {
55-
final String dir1 = "/foo/bar";
55+
final String slash = File.separator;
5656
final String sep = File.pathSeparator;
57-
final String dir2 = "/to/the/moon";
57+
final String dir1 = slash + "foo" + slash + "bar";
58+
final String dir2 = slash + "to" + slash + "the" + slash + "moon";
5859
System.setProperty("scijava.scripts.path", dir1 + sep + dir2);
5960

6061
final Context context = new Context(ScriptService.class);
@@ -63,8 +64,8 @@ public void testSystemProperty() {
6364
final List<File> scriptDirs = scriptService.getScriptDirectories();
6465
assertEquals(3, scriptDirs.size());
6566

66-
final String dir0 =
67-
AppUtils.getBaseDirectory(ScriptService.class) + "/scripts";
67+
final File baseDir = AppUtils.getBaseDirectory(ScriptService.class);
68+
final String dir0 = baseDir.getPath() + slash + "scripts";
6869
assertEquals(dir0, scriptDirs.get(0).getAbsolutePath());
6970
assertEquals(dir1, scriptDirs.get(1).getAbsolutePath());
7071
assertEquals(dir2, scriptDirs.get(2).getAbsolutePath());

0 commit comments

Comments
 (0)