aboutsummaryrefslogtreecommitdiff
path: root/src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinAnnotation.kt
diff options
context:
space:
mode:
authorJonas Herzig <jonas@spark-squared.com>2021-11-10 09:34:39 +0100
committerJonas Herzig <jonas@spark-squared.com>2021-11-10 18:11:16 +0100
commit7d62cd890cb44945e772e18cdb457b1173f4f853 (patch)
treee6f0e969442f464556289a090769e966bc0e2efe /src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinAnnotation.kt
parent89e079621c7867036d4ac77b018ad904d21364b5 (diff)
downloadRemap-7d62cd890cb44945e772e18cdb457b1173f4f853.tar.gz
Remap-7d62cd890cb44945e772e18cdb457b1173f4f853.tar.bz2
Remap-7d62cd890cb44945e772e18cdb457b1173f4f853.zip
Start adding tests
Diffstat (limited to 'src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinAnnotation.kt')
-rw-r--r--src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinAnnotation.kt52
1 files changed, 52 insertions, 0 deletions
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