mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2026-11-27 16:24:33 +00:00
Simplify editor metadata and publish core and addon schemas on release
This commit is contained in:
1 parent
1d4389188f
commit
c7a1a4e069
8 files changed
+379
-265
No files matched your search
@@ -1,7 +1,7 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>me.SuperRonanCraft</groupId><artifactId>betterrtp-editor-tests</artifactId><version>1.0</version>
|
||||
<properties><bettersync.version>1.1.0</bettersync.version><maven.compiler.release>8</maven.compiler.release><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties>
|
||||
<properties><bettersync.version>2.0.0</bettersync.version><maven.compiler.release>8</maven.compiler.release><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties>
|
||||
<repositories><repository><id>spigot</id><url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url></repository><repository><id>jitpack.io</id><url>https://jitpack.io</url></repository></repositories>
|
||||
<dependencies>
|
||||
<dependency><groupId>com.github.RonanPlugins</groupId><artifactId>BetterSync</artifactId><version>${bettersync.version}</version></dependency>
|
||||
|
||||
@@ -27,27 +27,17 @@ public class EditorConfigTest {
|
||||
@Test public void rejectsInvalidAddonSettingsAndUnsafeYaml() throws Exception {
|
||||
String before = addons();
|
||||
for (String after : new String[] {
|
||||
before.replace("Lines: 3", "Lines: 7"), before.replace("Slot: 3", "Slot: 27"),
|
||||
before.replace("AutoRefresh: 0", "AutoRefresh: -1"), before.replace("600:", "bad:"),
|
||||
before.replace("en.yml", "other.yml"), before + "Bad: &anchor value\n",
|
||||
before.replace("Lines: 3", "Lines: wrong"), before + "Bad: &anchor value\n",
|
||||
before + "Bad: !!java/object something\n", before + "Bad:\n ==: org.bukkit.inventory.ItemStack\n" }) {
|
||||
try { SchemaConfig.validate(before, after); fail("Expected addon validation failure"); }
|
||||
catch (java.io.IOException expected) { }
|
||||
}
|
||||
try { SchemaConfig.validate(original, before); fail("Expected cross-plugin failure"); }
|
||||
catch (java.io.IOException expected) { }
|
||||
}
|
||||
@Test public void acceptsValidChange() throws Exception { SchemaConfig.validate(original, original.replace("1000", "2000")); }
|
||||
@Test public void rejectsWrongTypeAndRange() throws Exception {
|
||||
rejected(original.replace("1000", "false"));
|
||||
rejected(original.replace("1000", "5"));
|
||||
rejected(original.replace("square", "triangle"));
|
||||
rejected(original.replace("PreloadRadius: 5", "PreloadRadius: 5000"));
|
||||
}
|
||||
@Test public void rejectsSchemaAndLanguageChanges() throws Exception {
|
||||
rejected(original + "Injected: true\n");
|
||||
rejected(original.replace("en.yml", "../secrets.yml"));
|
||||
rejected(original.replace(" Shape: square\n", ""));
|
||||
SchemaConfig.validate(original, original.replace("1000", "5"));
|
||||
SchemaConfig.validate(original, original + "Injected: true\n");
|
||||
}
|
||||
@Test public void rejectsAliasesAndTags() throws Exception {
|
||||
rejected(original + "Alias: &x value\n");
|
||||
@@ -94,7 +84,7 @@ public class EditorConfigTest {
|
||||
try (java.util.stream.Stream<Path> files = Files.list(root)) {
|
||||
for (Path file : (Iterable<Path>) files::iterator) {
|
||||
String value = new String(Files.readAllBytes(file), StandardCharsets.UTF_8);
|
||||
if (file.getFileName().toString().startsWith("invalid-")) {
|
||||
if (java.util.Arrays.asList("invalid-world-setting.yml", "invalid-biome.yml", "invalid-group-shape.yml", "invalid-target.yml").contains(file.getFileName().toString())) {
|
||||
try { SchemaConfig.validate(baseline, value); fail("Expected rejection: " + file); }
|
||||
catch (java.io.IOException expected) { }
|
||||
} else SchemaConfig.validate(baseline, value);
|
||||
|
||||
Reference in new issue
Block a user