|
32 | 32 | package org.scijava.script; |
33 | 33 |
|
34 | 34 | import static org.junit.Assert.assertEquals; |
| 35 | +import static org.junit.Assert.assertTrue; |
35 | 36 |
|
36 | 37 | import java.io.File; |
37 | 38 | import java.io.IOException; |
@@ -114,6 +115,7 @@ public void testFindScripts() { |
114 | 115 | "Math > Trig > tan", // |
115 | 116 | }; |
116 | 117 | assertMenuPaths(expected, scripts); |
| 118 | + assertURLsMatch(scripts); |
117 | 119 | } |
118 | 120 |
|
119 | 121 | /** |
@@ -148,6 +150,7 @@ public void testMenuPrefixes() { |
148 | 150 | "Foo > Bar > Math > Trig > tan", // |
149 | 151 | }; |
150 | 152 | assertMenuPaths(expected, scripts); |
| 153 | + assertURLsMatch(scripts); |
151 | 154 | } |
152 | 155 |
|
153 | 156 | /** |
@@ -181,6 +184,7 @@ public void testOverlappingDirectories() { |
181 | 184 | "Math > Trig > tan", // |
182 | 185 | }; |
183 | 186 | assertMenuPaths(expected, scripts); |
| 187 | + assertURLsMatch(scripts); |
184 | 188 | } |
185 | 189 |
|
186 | 190 | // -- Helper methods -- |
@@ -212,6 +216,14 @@ private void assertMenuPaths(final String[] expected, |
212 | 216 | } |
213 | 217 | } |
214 | 218 |
|
| 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 | + |
215 | 227 | // -- Helper classes -- |
216 | 228 |
|
217 | 229 | /** "Handles" scripts with .foo extension. */ |
|
0 commit comments