Forge tests: Add multiple Gradle versions where easily possible

This commit is contained in:
Juuz
2023-04-29 22:57:15 +03:00
parent 4efac2b3b9
commit ccbad51f17
3 changed files with 36 additions and 13 deletions

View File

@@ -1,7 +1,7 @@
/*
* This file is part of fabric-loom, licensed under the MIT License (MIT).
*
* Copyright (c) 2022 FabricMC
* Copyright (c) 2022-2023 FabricMC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -25,21 +25,26 @@
package net.fabricmc.loom.test.integration.forge
import spock.lang.Specification
import spock.lang.Unroll
import net.fabricmc.loom.test.util.GradleProjectTestTrait
import static net.fabricmc.loom.test.LoomTestConstants.DEFAULT_GRADLE
import static net.fabricmc.loom.test.LoomTestConstants.STANDARD_TEST_VERSIONS
import static org.gradle.testkit.runner.TaskOutcome.SUCCESS
class AccessTransformerTest extends Specification implements GradleProjectTestTrait {
def "build"() {
@Unroll
def "build (gradle #version)"() {
setup:
def gradle = gradleProject(project: "forge/accessTransformer", version: DEFAULT_GRADLE)
def gradle = gradleProject(project: "forge/accessTransformer", version: version)
when:
def result = gradle.run(task: "build")
then:
result.task(":build").outcome == SUCCESS
where:
version << STANDARD_TEST_VERSIONS
}
}

View File

@@ -1,7 +1,7 @@
/*
* This file is part of fabric-loom, licensed under the MIT License (MIT).
*
* Copyright (c) 2021 FabricMC
* Copyright (c) 2021-2023 FabricMC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -25,6 +25,7 @@
package net.fabricmc.loom.test.integration.forge
import spock.lang.Specification
import spock.lang.Unroll
import net.fabricmc.loom.test.util.GradleProjectTestTrait
@@ -32,10 +33,11 @@ import static net.fabricmc.loom.test.LoomTestConstants.*
import static org.gradle.testkit.runner.TaskOutcome.SUCCESS
class Aw2AtTest extends Specification implements GradleProjectTestTrait {
def "build"() {
@Unroll
def "build (gradle #version)"() {
// 1.17+ uses a new srg naming pattern
setup:
def gradle = gradleProject(project: "forge/aw2At", version: DEFAULT_GRADLE)
def gradle = gradleProject(project: "forge/aw2At", version: version)
when:
def result = gradle.run(task: "build")
@@ -43,9 +45,13 @@ class Aw2AtTest extends Specification implements GradleProjectTestTrait {
then:
result.task(":build").outcome == SUCCESS
gradle.getOutputZipEntry("fabric-example-mod-1.0.0.jar", "META-INF/accesstransformer.cfg") == expected(gradle).replaceAll('\r', '')
where:
version << STANDARD_TEST_VERSIONS
}
def "legacy build (mojmap)"() {
@Unroll
def "legacy build (mojmap, gradle #version)"() {
// old 1.16 srg names
setup:
def gradle = gradleProject(project: "forge/legacyAw2AtMojmap", version: DEFAULT_GRADLE)
@@ -56,9 +62,13 @@ class Aw2AtTest extends Specification implements GradleProjectTestTrait {
then:
result.task(":build").outcome == SUCCESS
gradle.getOutputZipEntry("fabric-example-mod-1.0.0.jar", "META-INF/accesstransformer.cfg") == expected(gradle).replaceAll('\r', '')
where:
version << STANDARD_TEST_VERSIONS
}
def "legacy build (yarn)"() {
@Unroll
def "legacy build (yarn, gradle #version)"() {
// old 1.16 srg names
setup:
def gradle = gradleProject(project: "forge/legacyAw2AtYarn", version: DEFAULT_GRADLE)
@@ -69,6 +79,9 @@ class Aw2AtTest extends Specification implements GradleProjectTestTrait {
then:
result.task(":build").outcome == SUCCESS
gradle.getOutputZipEntry("fabric-example-mod-1.0.0.jar", "META-INF/accesstransformer.cfg") == expected(gradle).replaceAll('\r', '')
where:
version << STANDARD_TEST_VERSIONS
}
private static String expected(GradleProject gradle) {

View File

@@ -1,7 +1,7 @@
/*
* This file is part of fabric-loom, licensed under the MIT License (MIT).
*
* Copyright (c) 2022 FabricMC
* Copyright (c) 2022-2023 FabricMC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -25,21 +25,26 @@
package net.fabricmc.loom.test.integration.forge
import spock.lang.Specification
import spock.lang.Unroll
import net.fabricmc.loom.test.util.GradleProjectTestTrait
import static net.fabricmc.loom.test.LoomTestConstants.DEFAULT_GRADLE
import static net.fabricmc.loom.test.LoomTestConstants.STANDARD_TEST_VERSIONS
import static org.gradle.testkit.runner.TaskOutcome.SUCCESS
class ExternalModDependencyTest extends Specification implements GradleProjectTestTrait {
def "build"() {
@Unroll
def "build (gradle #version)"() {
setup:
def gradle = gradleProject(project: "forge/externalModDependency", version: DEFAULT_GRADLE)
def gradle = gradleProject(project: "forge/externalModDependency", version: version)
when:
def result = gradle.run(task: "build")
then:
result.task(":build").outcome == SUCCESS
where:
version << STANDARD_TEST_VERSIONS
}
}