mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-28 04:07:01 -05:00
Fix unit tests
This commit is contained in:
@@ -25,8 +25,8 @@ public final class ModMetadataFiles {
|
||||
private static final Map<String, Function<byte[], ModMetadataFile>> SINGLE_FILE_METADATA_TYPES = ImmutableMap.<String, Function<byte[], ModMetadataFile>>builder()
|
||||
.put(QuiltModJson.FILE_NAME, QuiltModJson::of)
|
||||
.put(ArchitecturyCommonJson.FILE_NAME, ArchitecturyCommonJson::of)
|
||||
.put(ModsToml.FILE_PATH, onError(ModsToml::of, "Could not load mods.toml", () -> new ErroringModMetadataFile(ModsToml.FILE_PATH)))
|
||||
.put(ModsToml.NEOFORGE_FILE_PATH, onError(ModsToml::of, "Could not load mods.toml", () -> new ErroringModMetadataFile(ModsToml.NEOFORGE_FILE_PATH)))
|
||||
.put(ModsToml.FILE_PATH, onError(ModsToml::of, "Could not load mods.toml", () -> new ErroringModMetadataFile("mods.toml")))
|
||||
.put(ModsToml.NEOFORGE_FILE_PATH, onError(ModsToml::of, "Could not load neoforge.mods.toml", () -> new ErroringModMetadataFile("neoforge.mods.toml")))
|
||||
.build();
|
||||
|
||||
private static <A, B> Function<A, B> onError(Function<A, B> fn, String message, Supplier<B> onError) {
|
||||
|
||||
@@ -118,6 +118,17 @@ class ModMetadataFilesTest extends Specification {
|
||||
modMetadata.fileName == 'mods.toml [erroring]'
|
||||
}
|
||||
|
||||
def "read broken neoforge.mods.toml from directory"() {
|
||||
given:
|
||||
Files.createDirectories(workingDir.resolve('META-INF'))
|
||||
workingDir.resolve('META-INF/neoforge.mods.toml').text = ModsTomlTest.BROKEN_INPUT
|
||||
when:
|
||||
def modMetadata = ModMetadataFiles.fromDirectory(workingDir)
|
||||
then:
|
||||
modMetadata instanceof ErroringModMetadataFile
|
||||
modMetadata.fileName == 'neoforge.mods.toml [erroring]'
|
||||
}
|
||||
|
||||
def "read fabric.mod.json from directory"() {
|
||||
given:
|
||||
workingDir.resolve('fabric.mod.json').text = '''
|
||||
|
||||
Reference in New Issue
Block a user