From 7d62cd890cb44945e772e18cdb457b1173f4f853 Mon Sep 17 00:00:00 2001 From: Jonas Herzig Date: Wed, 10 Nov 2021 09:34:39 +0100 Subject: Start adding tests --- .../gradle/remap/mapper/TestMixinAnnotation.kt | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinAnnotation.kt (limited to 'src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinAnnotation.kt') diff --git a/src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinAnnotation.kt b/src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinAnnotation.kt new file mode 100644 index 0000000..1f9a3a2 --- /dev/null +++ b/src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinAnnotation.kt @@ -0,0 +1,52 @@ +package com.replaymod.gradle.remap.mapper + +import com.replaymod.gradle.remap.util.TestData +import io.kotest.matchers.shouldBe +import org.junit.jupiter.api.Test + +class TestMixinAnnotation { + @Test + fun `remaps with class target`() { + TestData.remap(""" + @org.spongepowered.asm.mixin.Mixin(a.pkg.A.class) + class MixinA { @Shadow private int aField; } + """.trimIndent()) shouldBe """ + @org.spongepowered.asm.mixin.Mixin(b.pkg.B.class) + class MixinA { @Shadow private int bField; } + """.trimIndent() + } + + @Test + fun `remaps with string target`() { + TestData.remap(""" + @org.spongepowered.asm.mixin.Mixin(targets = "a.pkg.A") + class MixinA { @Shadow private int aField; } + """.trimIndent()) shouldBe """ + @org.spongepowered.asm.mixin.Mixin(targets = "b.pkg.B") + class MixinA { @Shadow private int bField; } + """.trimIndent() + } + + @Test + fun `remaps with inner class string target separated by dot`() { + // FIXME should probably keep the dot? + TestData.remap(""" + @org.spongepowered.asm.mixin.Mixin(targets = "a.pkg.A.Inner") + class MixinA { @Shadow private int aField; } + """.trimIndent()) shouldBe """ + @org.spongepowered.asm.mixin.Mixin(targets = "b.pkg.B${'$'}Inner") + class MixinA { @Shadow private int bField; } + """.trimIndent() + } + + @Test + fun `remaps with inner class string target separated by dollar`() { + TestData.remap(""" + @org.spongepowered.asm.mixin.Mixin(targets = "a.pkg.A${'$'}Inner") + class MixinA { @Shadow private int aField; } + """.trimIndent()) shouldBe """ + @org.spongepowered.asm.mixin.Mixin(targets = "b.pkg.B${'$'}Inner") + class MixinA { @Shadow private int bField; } + """.trimIndent() + } +} \ No newline at end of file -- cgit