mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-23 00:28:02 +00:00
Stabilized NeoForge test suite
- Pack validation publication tests pin the registry context instead of reading a bound platform - NeoForge tests skip the mixin package, which mod-layer tests cannot load
This commit is contained in:
1 parent
a9b394ee5d
commit
e1049949c6
2 files changed
+14
-4
No files matched your search
+13
-4
@@ -7,6 +7,7 @@ import art.arcane.iris.pack.PackValidationCache;
|
||||
import art.arcane.iris.pack.PackValidationResult;
|
||||
import art.arcane.iris.pack.PackValidator;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
@@ -31,8 +32,18 @@ public class ModdedPackValidationPublicationTest {
|
||||
@Rule
|
||||
public TemporaryFolder temporaryFolder = new TemporaryFolder();
|
||||
|
||||
private final AtomicReference<String> context = new AtomicReference<>("context");
|
||||
private MockedStatic<PackValidationCache> cache;
|
||||
|
||||
@Before
|
||||
public void pinValidationContext() {
|
||||
cache = mockStatic(PackValidationCache.class);
|
||||
cache.when(PackValidationCache::contextFingerprint).thenAnswer(ignored -> context.get());
|
||||
}
|
||||
|
||||
@After
|
||||
public void clearValidation() {
|
||||
cache.close();
|
||||
PackValidationRegistry.clear();
|
||||
}
|
||||
|
||||
@@ -71,12 +82,10 @@ public class ModdedPackValidationPublicationTest {
|
||||
@Test
|
||||
public void snapshotValidationReparsesChangedRegistryContext() throws Exception {
|
||||
File root = temporaryFolder.newFolder("snapshot");
|
||||
AtomicReference<String> context = new AtomicReference<>("first");
|
||||
context.set("first");
|
||||
PackValidationResult first = loadable(root);
|
||||
PackValidationResult second = loadable(root);
|
||||
try (MockedStatic<PackValidator> validator = mockStatic(PackValidator.class);
|
||||
MockedStatic<PackValidationCache> cache = mockStatic(PackValidationCache.class)) {
|
||||
cache.when(PackValidationCache::contextFingerprint).thenAnswer(ignored -> context.get());
|
||||
try (MockedStatic<PackValidator> validator = mockStatic(PackValidator.class)) {
|
||||
validator.when(() -> PackValidator.validate(root)).thenReturn(first, second);
|
||||
assertSame(first, ModdedGenerationHistoryStorage.validatePack(root.toPath(), null));
|
||||
context.set("second");
|
||||
|
||||
@@ -248,6 +248,7 @@ tasks.named('compileJava', JavaCompile).configure {
|
||||
tasks.named('test').configure {
|
||||
useJUnitPlatform()
|
||||
classpath = classpath.minus(developmentModLibraries).plus(sourceSets.modLibraries.output)
|
||||
exclude('art/arcane/volmlib/nativelib/minecraft26_2/modded/mixin/**')
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
||||
Reference in new issue
Block a user