This commit is contained in:
Brian Neumann-Fopiano committed 2026-08-13 16:54:37 -04:00
1 parent 1586b4bd1a
commit 32beca236c
49 files changed
+311 -1136

No files matched your search

@@ -1,31 +0,0 @@
package art.arcane.iris.modded;
import org.junit.Test;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
public class ModdedDownloadBranchParityTest {
private static final List<String> DOWNLOAD_SOURCES = List.of(
"art/arcane/iris/modded/command/ModdedWorldCommands.java",
"art/arcane/iris/modded/command/ModdedStudioCommands.java",
"art/arcane/iris/modded/command/ModdedCommandTree.java");
@Test
public void implicitAndExplicitDownloadsShareTheCoreDefaultBranch() throws Exception {
for (String source : DOWNLOAD_SOURCES) {
Path path = Path.of(System.getProperty("iris.moddedCommonSources"), source);
String text = Files.readString(path);
assertFalse(source + " must not hardcode a \"master\" download branch",
text.contains("\"master\""));
assertFalse(source + " must not hardcode a \"stable\" download branch",
text.contains("\"stable\""));
assertTrue(source + " must use PackDownloader.DEFAULT_BRANCH",
text.contains("PackDownloader.DEFAULT_BRANCH"));
}
}
}
@@ -1,52 +0,0 @@
/*
* Iris is a World Generator for Minecraft Servers
* Copyright (c) 2026 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package art.arcane.iris.modded;
import art.arcane.iris.core.pack.PackDownloader;
import org.junit.Test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
public class ModdedPackInstallerTest {
@Test
public void managedPacksIgnoreTheRequestedBranch() {
assertTrue(ModdedPackInstaller.acceptsBranch("overworld", null));
assertTrue(ModdedPackInstaller.acceptsBranch("underworld", "feature/arbitrary"));
}
@Test
public void nonManagedPacksStillRequireAValidBranch() {
assertTrue(ModdedPackInstaller.acceptsBranch("custom", "stable"));
assertFalse(ModdedPackInstaller.acceptsBranch("custom", null));
assertFalse(ModdedPackInstaller.acceptsBranch("custom", "feature/arbitrary"));
}
@Test
public void startupBatchDefersDatapackRefresh() {
PackDownloader.PackInstallResult changed = new PackDownloader.PackInstallResult("underworld", true, true);
assertFalse(ModdedPackInstaller.shouldRefreshDatapack(changed, false));
assertTrue(ModdedPackInstaller.shouldRefreshDatapack(changed, true));
assertFalse(ModdedPackInstaller.shouldRefreshDatapack(
new PackDownloader.PackInstallResult("underworld", false, false),
true
));
}
}
@@ -10,7 +10,9 @@ import org.junit.Test;
import java.util.List;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class IrisModdedCommandParityTest {
@@ -50,17 +52,34 @@ public class IrisModdedCommandParityTest {
child(studio, "pkg");
CommandNode<CommandSourceStack> download = child(iris, "download");
CommandNode<CommandSourceStack> pack = child(download, "pack");
child(pack, "force");
child(pack, "overwrite");
CommandNode<CommandSourceStack> branch = child(pack, "branch");
child(branch, "force");
child(branch, "overwrite");
CommandNode<CommandSourceStack> source = child(download, "source");
assertTrue(source.getChildren().isEmpty());
assertSame(iris, child(dispatcher.getRoot(), "ir").getRedirect());
assertSame(iris, child(dispatcher.getRoot(), "irs").getRedirect());
}
@Test
public void downloadRequestAcceptsOnlyBuiltInsAndZipLinks() {
IrisModdedCommands.DownloadRequest overworld = IrisModdedCommands.parseDownloadRequest("pack=overworld");
IrisModdedCommands.DownloadRequest underworld = IrisModdedCommands.parseDownloadRequest("pack=UNDERWORLD");
IrisModdedCommands.DownloadRequest link = IrisModdedCommands.parseDownloadRequest(
"link=https://packs.example.test/custom.zip?token=a=b"
);
assertNotNull(overworld);
assertEquals("overworld", overworld.pack());
assertNotNull(underworld);
assertEquals("underworld", underworld.pack());
assertNotNull(link);
assertEquals("https://packs.example.test/custom.zip?token=a=b", link.url());
assertNull(IrisModdedCommands.parseDownloadRequest("overworld"));
assertNull(IrisModdedCommands.parseDownloadRequest("pack=custom"));
assertNull(IrisModdedCommands.parseDownloadRequest("link=https://packs.example.test/custom.tar.gz"));
assertNull(IrisModdedCommands.parseDownloadRequest("pack=underworld branch=stable"));
assertNull(IrisModdedCommands.parseDownloadRequest("pack=underworld overwrite=true"));
}
@Test
public void helpDocumentsParityCommandsAndPlatformStubs() {
assertTrue(ModdedCommandHelp.documents("what", "here"));