Skip to content

Commit 5f7d518

Browse files
committed
ScriptFinderTest: test that the URLs are retained
1 parent 76b0156 commit 5f7d518

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
package org.scijava.script;
3333

3434
import static org.junit.Assert.assertEquals;
35+
import static org.junit.Assert.assertTrue;
3536

3637
import java.io.File;
3738
import java.io.IOException;
@@ -114,6 +115,7 @@ public void testFindScripts() {
114115
"Math > Trig > tan", //
115116
};
116117
assertMenuPaths(expected, scripts);
118+
assertURLsMatch(scripts);
117119
}
118120

119121
/**
@@ -148,6 +150,7 @@ public void testMenuPrefixes() {
148150
"Foo > Bar > Math > Trig > tan", //
149151
};
150152
assertMenuPaths(expected, scripts);
153+
assertURLsMatch(scripts);
151154
}
152155

153156
/**
@@ -181,6 +184,7 @@ public void testOverlappingDirectories() {
181184
"Math > Trig > tan", //
182185
};
183186
assertMenuPaths(expected, scripts);
187+
assertURLsMatch(scripts);
184188
}
185189

186190
// -- Helper methods --
@@ -212,6 +216,14 @@ private void assertMenuPaths(final String[] expected,
212216
}
213217
}
214218

219+
private void assertURLsMatch(final ArrayList<ScriptInfo> scripts) {
220+
for (final ScriptInfo info : scripts) {
221+
final String urlPath = info.getURL().getPath();
222+
final String path = info.getPath();
223+
assertTrue(urlPath + " <> " + path, urlPath.endsWith("/" + path));
224+
}
225+
}
226+
215227
// -- Helper classes --
216228

217229
/** "Handles" scripts with .foo extension. */

0 commit comments

Comments
 (0)