-
-
Notifications
You must be signed in to change notification settings - Fork 531
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added the tests for transporters from (#7748) - Reduced the number of game test sourcesets to one, and allow it to access all the other mekanism modules - Make use of Neo's Game Test Framework as it is nicer to work with and will eventually allow us to validate the tests via GHA - Moved the run configs to using their own run folders
- Loading branch information
1 parent
2401c84
commit b792593
Showing
12 changed files
with
640 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,7 @@ out | |
|
||
Mekanism*.jar | ||
MDK.zip | ||
/run | ||
/runGameTests | ||
/runs | ||
/.gradle | ||
*.classpath | ||
*.project | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/gameTest/java/mekanism/common/tests/MekanismTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package mekanism.common.tests; | ||
|
||
import com.mojang.brigadier.builder.LiteralArgumentBuilder; | ||
import net.minecraft.commands.CommandSourceStack; | ||
import net.minecraft.commands.Commands; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.neoforged.bus.api.IEventBus; | ||
import net.neoforged.fml.ModContainer; | ||
import net.neoforged.fml.common.Mod; | ||
import net.neoforged.neoforge.common.NeoForge; | ||
import net.neoforged.neoforge.event.RegisterCommandsEvent; | ||
import net.neoforged.testframework.conf.ClientConfiguration; | ||
import net.neoforged.testframework.conf.Feature; | ||
import net.neoforged.testframework.conf.FrameworkConfiguration; | ||
import net.neoforged.testframework.impl.MutableTestFramework; | ||
import org.lwjgl.glfw.GLFW; | ||
|
||
@Mod(MekanismTests.MODID) | ||
public class MekanismTests { | ||
|
||
public static final String MODID = "mekanismtests"; | ||
|
||
public MekanismTests(IEventBus modBus, ModContainer container) { | ||
//More or less a copy of net.neoforged.neoforge.eventtest.internal.TestsMod but with a few tweaks | ||
final MutableTestFramework framework = FrameworkConfiguration.builder(rl("tests")) | ||
.clientConfiguration(() -> ClientConfiguration.builder() | ||
.toggleOverlayKey(GLFW.GLFW_KEY_O) | ||
.openManagerKey(GLFW.GLFW_KEY_M) | ||
.build()) | ||
.enable(Feature.CLIENT_SYNC, Feature.TEST_STORE) | ||
//TODO: Figure out which dumpers we want to enable and how they work | ||
//.dumpers(new JUnitSummaryDumper(Path.of("gameTest/")), new GitHubActionsStepSummaryDumper()) | ||
.build().create(); | ||
|
||
framework.init(modBus, container); | ||
|
||
NeoForge.EVENT_BUS.addListener((final RegisterCommandsEvent event) -> { | ||
final LiteralArgumentBuilder<CommandSourceStack> node = Commands.literal("tests"); | ||
framework.registerCommands(node); | ||
event.getDispatcher().register(node); | ||
}); | ||
} | ||
|
||
public static ResourceLocation rl(String path) { | ||
return new ResourceLocation(MODID, path); | ||
} | ||
} |
Oops, something went wrong.