blob: 1f9a3a2e6f2786ecfa391f6ddf29c6a01b838046 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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()
}
}
|