Add test for evaluating all item scripts
This commit is contained in:
@@ -21,14 +21,18 @@ public class ScriptEvaluationTest {
|
|||||||
System.setProperty("polyglot.engine.WarnInterpreterOnly", "false");
|
System.setProperty("polyglot.engine.WarnInterpreterOnly", "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<String> npcScriptFilePaths() throws IOException {
|
|
||||||
return getScriptFilePaths("npc");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static List<String> eventScriptFilePaths() throws IOException {
|
private static List<String> eventScriptFilePaths() throws IOException {
|
||||||
return getScriptFilePaths("event");
|
return getScriptFilePaths("event");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static List<String> itemScriptFilePaths() throws IOException {
|
||||||
|
return getScriptFilePaths("item");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<String> npcScriptFilePaths() throws IOException {
|
||||||
|
return getScriptFilePaths("npc");
|
||||||
|
}
|
||||||
|
|
||||||
private static List<String> getScriptFilePaths(final String scriptsSubdirectory) throws IOException {
|
private static List<String> getScriptFilePaths(final String scriptsSubdirectory) throws IOException {
|
||||||
Path scriptDirectory = Path.of("scripts", scriptsSubdirectory);
|
Path scriptDirectory = Path.of("scripts", scriptsSubdirectory);
|
||||||
try (Stream<Path> pathStream = Files.walk(scriptDirectory)) {
|
try (Stream<Path> pathStream = Files.walk(scriptDirectory)) {
|
||||||
@@ -47,6 +51,14 @@ public class ScriptEvaluationTest {
|
|||||||
assertNotNull(scriptEngine);
|
assertNotNull(scriptEngine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ParameterizedTest
|
||||||
|
@MethodSource("itemScriptFilePaths")
|
||||||
|
void itemScriptShouldEvaluate(String itemScriptPath) {
|
||||||
|
ScriptEngine scriptEngine = scriptManager.getInvocableScriptEngine(itemScriptPath);
|
||||||
|
|
||||||
|
assertNotNull(scriptEngine);
|
||||||
|
}
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@MethodSource("npcScriptFilePaths")
|
@MethodSource("npcScriptFilePaths")
|
||||||
void npcScriptShouldEvaluate(String npcScriptPath) {
|
void npcScriptShouldEvaluate(String npcScriptPath) {
|
||||||
|
|||||||
Reference in New Issue
Block a user