diff options
Diffstat (limited to 'src/test/kotlin/com/replaymod/gradle/remap/mapper')
3 files changed, 71 insertions, 0 deletions
diff --git a/src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinAccessors.kt b/src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinAccessors.kt index 4b9450f..9933606 100644 --- a/src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinAccessors.kt +++ b/src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinAccessors.kt @@ -62,4 +62,21 @@ class TestMixinAccessors { } """.trimIndent() } + + @Test + fun `does not change @Accessor method name even when it happens to be the same as a method in the target`() { + TestData.remap(""" + @org.spongepowered.asm.mixin.Mixin(a.pkg.A.class) + interface MixinA { + @org.spongepowered.asm.mixin.gen.Accessor + a.pkg.A getA(); + } + """.trimIndent()) shouldBe """ + @org.spongepowered.asm.mixin.Mixin(b.pkg.B.class) + interface MixinA { + @org.spongepowered.asm.mixin.gen.Accessor("b") + b.pkg.B getA(); + } + """.trimIndent() + } }
\ No newline at end of file diff --git a/src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinOverride.kt b/src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinOverride.kt new file mode 100644 index 0000000..6caaeba --- /dev/null +++ b/src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinOverride.kt @@ -0,0 +1,28 @@ +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 TestMixinOverride { + @Test + fun `remaps overridden method`() { + TestData.remap(""" + @org.spongepowered.asm.mixin.Mixin(a.pkg.A.class) + abstract class MixinA extends a.pkg.AParent { + @Override + public a.pkg.AParent aParentMethod() { + return this; + } + } + """.trimIndent()) shouldBe """ + @org.spongepowered.asm.mixin.Mixin(b.pkg.B.class) + abstract class MixinA extends b.pkg.BParent { + @Override + public b.pkg.BParent bParentMethod() { + return this; + } + } + """.trimIndent() + } +}
\ No newline at end of file diff --git a/src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinShadow.kt b/src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinShadow.kt new file mode 100644 index 0000000..bc4ebe6 --- /dev/null +++ b/src/test/kotlin/com/replaymod/gradle/remap/mapper/TestMixinShadow.kt @@ -0,0 +1,26 @@ +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 TestMixinShadow { + @Test + fun `remaps shadow method and references to it`() { + TestData.remap(""" + @org.spongepowered.asm.mixin.Mixin(a.pkg.A.class) + abstract class MixinA { + @org.spongepowered.asm.mixin.Shadow + protected abstract a.pkg.A getA(); + private void test() { this.getA(); } + } + """.trimIndent()) shouldBe """ + @org.spongepowered.asm.mixin.Mixin(b.pkg.B.class) + abstract class MixinA { + @org.spongepowered.asm.mixin.Shadow + protected abstract b.pkg.B getB(); + private void test() { this.getB(); } + } + """.trimIndent() + } +}
\ No newline at end of file |