aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorJonas Herzig <jonas@spark-squared.com>2021-11-12 19:00:04 +0100
committerJonas Herzig <jonas@spark-squared.com>2021-11-13 10:28:09 +0100
commitb00673f859058ff180dc16c22e12ac5698ffbab2 (patch)
tree4f08cda09664b14d54d34a1db489eaa2a8e621d1 /src/test
parente96738ddc97b4f564a8f783be1b5e5f937bef4a6 (diff)
downloadRemap-b00673f859058ff180dc16c22e12ac5698ffbab2.tar.gz
Remap-b00673f859058ff180dc16c22e12ac5698ffbab2.tar.bz2
Remap-b00673f859058ff180dc16c22e12ac5698ffbab2.zip
Implement synthetic property to/from setter conversion
Diffstat (limited to 'src/test')
-rw-r--r--src/test/kotlin/com/replaymod/gradle/remap/mapper/kotlin/TestKotlinSyntheticProperties.kt44
1 files changed, 37 insertions, 7 deletions
diff --git a/src/test/kotlin/com/replaymod/gradle/remap/mapper/kotlin/TestKotlinSyntheticProperties.kt b/src/test/kotlin/com/replaymod/gradle/remap/mapper/kotlin/TestKotlinSyntheticProperties.kt
index 65459f2..7a4ab4e 100644
--- a/src/test/kotlin/com/replaymod/gradle/remap/mapper/kotlin/TestKotlinSyntheticProperties.kt
+++ b/src/test/kotlin/com/replaymod/gradle/remap/mapper/kotlin/TestKotlinSyntheticProperties.kt
@@ -2,7 +2,6 @@ package com.replaymod.gradle.remap.mapper.kotlin
import com.replaymod.gradle.remap.util.TestData
import io.kotest.matchers.shouldBe
-import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
class TestKotlinSyntheticProperties {
@@ -63,37 +62,43 @@ class TestKotlinSyntheticProperties {
}
@Test
- @Disabled("not yet implemented")
fun `converts synthetic property to setter if no longer synthetic`() {
TestData.remapKt("""
import a.pkg.A
fun test() {
A().nonSyntheticA = A()
- A().isNonSyntheticBooleanA = true
+ A().isNonSyntheticBooleanA =
+ // Comment
+ true // More comment
}
""".trimIndent()) shouldBe """
import b.pkg.B
fun test() {
B().setterB(B())
- B().setterBooleanB(true)
+ B().setterBooleanB(
+ // Comment
+ true) // More comment
}
""".trimIndent()
}
@Test
- @Disabled("not yet implemented")
fun `converts setter to synthetic property if now synthetic`() {
TestData.remapKt("""
import a.pkg.A
fun test() {
A().setterA(A())
- A().setterBooleanA(true)
+ A().setterBooleanA(
+ // Comment
+ true) // More comment
}
""".trimIndent()) shouldBe """
import b.pkg.B
fun test() {
B().nonSyntheticB = B()
- B().isNonSyntheticBooleanB = true
+ B().isNonSyntheticBooleanB =
+ // Comment
+ true // More comment
}
""".trimIndent()
}
@@ -170,4 +175,29 @@ class TestKotlinSyntheticProperties {
fun test() { Kt().syntheticB = Kt() }
""".trimIndent()
}
+
+ @Test
+ fun `does not replace super calls with synthetic properties`() {
+ TestData.remapKt("""
+ import a.pkg.A
+ class C : A() {
+ init {
+ super.getSyntheticA()
+ super.isSyntheticBooleanA()
+ super.setSyntheticA(A())
+ super.setSyntheticBooleanA(true)
+ }
+ }
+ """.trimIndent()) shouldBe """
+ import b.pkg.B
+ class C : B() {
+ init {
+ super.getSyntheticB()
+ super.isSyntheticBooleanB()
+ super.setSyntheticB(B())
+ super.setSyntheticBooleanB(true)
+ }
+ }
+ """.trimIndent()
+ }
}