This commit is contained in:
Brian Neumann-Fopiano committed 2026-08-24 02:27:26 -04:00
1 parent fe5651f854
commit e20bb86f40
228 files changed
+5716 -3577

No files matched your search

@@ -0,0 +1,38 @@
package art.arcane.iris.client;
import art.arcane.iris.spi.protocol.IrisMessage;
import org.junit.Test;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
public class IrisClientHotloadTest {
private static final IrisMessage.DimensionStatus OVERWORLD = new IrisMessage.DimensionStatus(
"overworld",
"pack",
1L,
-64,
320,
true
);
@Test
public void successfulCurrentPackHotloadInvalidatesWorldCaches() {
IrisMessage.StudioHotload hotload = new IrisMessage.StudioHotload("pack", 0, false, "");
assertTrue(IrisClient.shouldInvalidateForHotload(OVERWORLD, hotload));
}
@Test
public void failedOrUnrelatedHotloadRetainsWorldCaches() {
assertFalse(IrisClient.shouldInvalidateForHotload(
OVERWORLD,
new IrisMessage.StudioHotload("pack", 0, true, "failed")
));
assertFalse(IrisClient.shouldInvalidateForHotload(
OVERWORLD,
new IrisMessage.StudioHotload("other", 0, false, "")
));
assertFalse(IrisClient.shouldInvalidateForHotload(null, null));
}
}
@@ -5,7 +5,10 @@ import org.junit.Test;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.stream.Stream;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
/**
@@ -24,4 +27,49 @@ public class ModdedIrisLogLevelCoverageTest {
String body = source.substring(router, source.indexOf("public static void debug(", router));
assertTrue(body, body.contains("default -> info(message);"));
}
@Test
public void slf4jStyleArgumentsAndTrailingThrowableArePreserved() {
RuntimeException failure = new RuntimeException("broken");
ModdedIrisLog.RenderedLog rendered = ModdedIrisLog.render("chunk {},{} failed", 4, 9, failure);
assertEquals("chunk 4,9 failed", rendered.message());
assertEquals(failure, rendered.error());
}
@Test
public void formattedDebugThrowableUsesTheVisibleDebugRouteWhenEnabled() throws IOException {
String source = Files.readString(Path.of(System.getProperty("iris.moddedCommonSources"),
"art/arcane/iris/modded/ModdedIrisLog.java"));
int start = source.indexOf("public static void debug(String format, Object... arguments)");
int end = source.indexOf("public static void info(String message)", start);
assertTrue("formatted debug overload not found", start >= 0);
assertTrue("formatted debug overload boundary not found", end > start);
String body = source.substring(start, end);
assertTrue(body, body.contains("if (!debugEnabled())"));
assertTrue(body, body.contains("LOGGER.info(\"[Iris/DEBUG] \" + clean(rendered.message()), rendered.error())"));
}
@Test
public void moddedProductionUsesTheIrisLogFrontDoor() throws IOException {
Path root = Path.of(System.getProperty("iris.moddedCommonSources"));
try (Stream<Path> files = Files.walk(root)) {
List<Path> bypasses = files
.filter(path -> path.toString().endsWith(".java"))
.filter(path -> !path.getFileName().toString().equals("ModdedIrisLog.java"))
.filter(path -> {
try {
String source = Files.readString(path);
return source.contains("LoggerFactory.getLogger")
|| source.contains("private static final Logger LOGGER");
} catch (IOException unreadable) {
throw new IllegalStateException(unreadable);
}
})
.toList();
assertTrue(bypasses.toString(), bypasses.isEmpty());
}
}
}
@@ -91,7 +91,7 @@ public class ModdedPlatformPathsTest {
File iris = new File(temporaryFolder.getRoot(), "iris");
assertEquals(iris, platform.dataFolder());
assertEquals(new File(iris, "settings.json"), platform.dataFile("settings.json"));
assertEquals(new File(iris, "iris.json"), platform.dataFile("iris.json"));
assertEquals(new File(iris, "parity"), platform.dataFolder("parity"));
}