blob: a3a6efc9522e938482540a3684a9683369c81691 (
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
|
package com.replaymod.gradle.remap.pattern
import com.replaymod.gradle.remap.util.TestData
import io.kotest.matchers.shouldBe
import org.junit.jupiter.api.Test
class TestFieldReference {
@Test
fun `should match field on left side of assignment when replaced by field`() {
TestData.remap("test/Test.java", """
class Test {
Test field;
private void test() {
field = field;
this.field = this.field;
this.field.field = this.field.field;
}
}
""".trimIndent(), """
@remap.Pattern
private test.Test pattern(test.Test obj) {
return obj.field;
}
""".trimIndent(), """
@remap.Pattern
private test.Test pattern(test.Test obj) {
return obj.matched;
}
""".trimIndent()) shouldBe """
class Test {
Test field;
private void test() {
field = field;
this.matched = this.matched;
this.matched.matched = this.matched.matched;
}
}
""".trimIndent()
}
}
|