Skip to content

Commit

Permalink
add neoforge test
Browse files Browse the repository at this point in the history
  • Loading branch information
jpenilla committed Dec 3, 2024
1 parent 43164ac commit 6b4139a
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 9 deletions.
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ allprojects {
}
}

dependencies {
testImplementation "org.junit.jupiter:junit-jupiter:${rootProject.junit_version}"
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

tasks.test {
useJUnitPlatform()
}
Expand Down
16 changes: 8 additions & 8 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,6 @@ tasks.shadowJar {
relocate 'org.yaml.snakeyaml', 'ca.spottedleaf.moonrise.libs.org.yaml.snakeyaml'
}

tasks.test {
def classPathGroups = SourceSetHelper.getClasspath(loom.mods.main, getProject()).stream()
.map(File.&getAbsolutePath)
.collect(Collectors.joining(File.pathSeparator))

systemProperty("fabric.classPathGroups", classPathGroups)
}

publishMods {
file = remapJar.archiveFile
modLoaders = ["fabric"]
Expand Down Expand Up @@ -96,6 +88,14 @@ loom {
}
}

tasks.test {
def classPathGroups = SourceSetHelper.getClasspath(loom.mods.main, getProject()).stream()
.map(File.&getAbsolutePath)
.collect(Collectors.joining(File.pathSeparator))

systemProperty("fabric.classPathGroups", classPathGroups)
}

afterEvaluate {
loom.runs.configureEach { cfg ->
runConfigCommon.systemProperties.get().each {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.junit.jupiter.api.Test;
import org.spongepowered.asm.mixin.MixinEnvironment;

public class MixinAuditTest {
class MixinAuditTest {
@BeforeAll
static void beforeAll() {
SharedConstants.tryDetectVersion();
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ concurrentutil_version=0.0.2-SNAPSHOT
yamlconfig_version=1.0.2-SNAPSHOT
cloth_version=16.0.141
modmenu_version=12.0.0-beta.1
junit_version=5.11.3
# version ids from modrinth
fabric_lithium_version=QhCwdt4l
neo_lithium_version=wDD955sb
Expand Down
4 changes: 4 additions & 0 deletions neoforge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ neoForge {
server()
}
}
unitTest {
enable()
testedMod = mods.moonrise
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package ca.spottedleaf.moonrise.neoforge;

import org.junit.jupiter.api.Test;
import org.spongepowered.asm.mixin.MixinEnvironment;

class MixinAuditTest {
@Test
void auditMixins() {
final ClassLoader old = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(MixinAuditTest.class.getClassLoader());
MixinEnvironment.getCurrentEnvironment().audit();
} finally {
Thread.currentThread().setContextClassLoader(old);
}
}
}

0 comments on commit 6b4139a

Please sign in to comment.