mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-26 22:10:18 +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.PackValidationResult;
|
||||||
import art.arcane.iris.pack.PackValidator;
|
import art.arcane.iris.pack.PackValidator;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.rules.TemporaryFolder;
|
import org.junit.rules.TemporaryFolder;
|
||||||
@@ -31,8 +32,18 @@ public class ModdedPackValidationPublicationTest {
|
|||||||
@Rule
|
@Rule
|
||||||
public TemporaryFolder temporaryFolder = new TemporaryFolder();
|
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
|
@After
|
||||||
public void clearValidation() {
|
public void clearValidation() {
|
||||||
|
cache.close();
|
||||||
PackValidationRegistry.clear();
|
PackValidationRegistry.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,12 +82,10 @@ public class ModdedPackValidationPublicationTest {
|
|||||||
@Test
|
@Test
|
||||||
public void snapshotValidationReparsesChangedRegistryContext() throws Exception {
|
public void snapshotValidationReparsesChangedRegistryContext() throws Exception {
|
||||||
File root = temporaryFolder.newFolder("snapshot");
|
File root = temporaryFolder.newFolder("snapshot");
|
||||||
AtomicReference<String> context = new AtomicReference<>("first");
|
context.set("first");
|
||||||
PackValidationResult first = loadable(root);
|
PackValidationResult first = loadable(root);
|
||||||
PackValidationResult second = loadable(root);
|
PackValidationResult second = loadable(root);
|
||||||
try (MockedStatic<PackValidator> validator = mockStatic(PackValidator.class);
|
try (MockedStatic<PackValidator> validator = mockStatic(PackValidator.class)) {
|
||||||
MockedStatic<PackValidationCache> cache = mockStatic(PackValidationCache.class)) {
|
|
||||||
cache.when(PackValidationCache::contextFingerprint).thenAnswer(ignored -> context.get());
|
|
||||||
validator.when(() -> PackValidator.validate(root)).thenReturn(first, second);
|
validator.when(() -> PackValidator.validate(root)).thenReturn(first, second);
|
||||||
assertSame(first, ModdedGenerationHistoryStorage.validatePack(root.toPath(), null));
|
assertSame(first, ModdedGenerationHistoryStorage.validatePack(root.toPath(), null));
|
||||||
context.set("second");
|
context.set("second");
|
||||||
|
|||||||
@@ -248,6 +248,7 @@ tasks.named('compileJava', JavaCompile).configure {
|
|||||||
tasks.named('test').configure {
|
tasks.named('test').configure {
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
classpath = classpath.minus(developmentModLibraries).plus(sourceSets.modLibraries.output)
|
classpath = classpath.minus(developmentModLibraries).plus(sourceSets.modLibraries.output)
|
||||||
|
exclude('art/arcane/volmlib/nativelib/minecraft26_2/modded/mixin/**')
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
|
|||||||
Reference in new issue
Block a user