Add test for evaluating all item scripts

This commit is contained in:
P0nk
2022-08-19 19:55:27 +02:00
parent 6ae2235083
commit 3354345cef

View File

@@ -21,14 +21,18 @@ public class ScriptEvaluationTest {
System.setProperty("polyglot.engine.WarnInterpreterOnly", "false");
}
private static List<String> npcScriptFilePaths() throws IOException {
return getScriptFilePaths("npc");
}
private static List<String> eventScriptFilePaths() throws IOException {
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 {
Path scriptDirectory = Path.of("scripts", scriptsSubdirectory);
try (Stream<Path> pathStream = Files.walk(scriptDirectory)) {
@@ -47,6 +51,14 @@ public class ScriptEvaluationTest {
assertNotNull(scriptEngine);
}
@ParameterizedTest
@MethodSource("itemScriptFilePaths")
void itemScriptShouldEvaluate(String itemScriptPath) {
ScriptEngine scriptEngine = scriptManager.getInvocableScriptEngine(itemScriptPath);
assertNotNull(scriptEngine);
}
@ParameterizedTest
@MethodSource("npcScriptFilePaths")
void npcScriptShouldEvaluate(String npcScriptPath) {