From ccbad51f17d061473714d52a176dbc9e1c70f50d Mon Sep 17 00:00:00 2001 From: Juuz <6596629+Juuxel@users.noreply.github.com> Date: Sat, 29 Apr 2023 22:57:15 +0300 Subject: [PATCH] Forge tests: Add multiple Gradle versions where easily possible --- .../forge/AccessTransformerTest.groovy | 13 +++++++---- .../test/integration/forge/Aw2AtTest.groovy | 23 +++++++++++++++---- .../forge/ExternalModDependencyTest.groovy | 13 +++++++---- 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/src/test/groovy/net/fabricmc/loom/test/integration/forge/AccessTransformerTest.groovy b/src/test/groovy/net/fabricmc/loom/test/integration/forge/AccessTransformerTest.groovy index 1c00e5ee..33766af6 100644 --- a/src/test/groovy/net/fabricmc/loom/test/integration/forge/AccessTransformerTest.groovy +++ b/src/test/groovy/net/fabricmc/loom/test/integration/forge/AccessTransformerTest.groovy @@ -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 } } diff --git a/src/test/groovy/net/fabricmc/loom/test/integration/forge/Aw2AtTest.groovy b/src/test/groovy/net/fabricmc/loom/test/integration/forge/Aw2AtTest.groovy index 27cc4212..729e2b4f 100644 --- a/src/test/groovy/net/fabricmc/loom/test/integration/forge/Aw2AtTest.groovy +++ b/src/test/groovy/net/fabricmc/loom/test/integration/forge/Aw2AtTest.groovy @@ -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) { diff --git a/src/test/groovy/net/fabricmc/loom/test/integration/forge/ExternalModDependencyTest.groovy b/src/test/groovy/net/fabricmc/loom/test/integration/forge/ExternalModDependencyTest.groovy index acd48c94..a133eb52 100644 --- a/src/test/groovy/net/fabricmc/loom/test/integration/forge/ExternalModDependencyTest.groovy +++ b/src/test/groovy/net/fabricmc/loom/test/integration/forge/ExternalModDependencyTest.groovy @@ -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 } }