Update tests to test instruction merging

This commit is contained in:
Gabriel Tofvesson 2020-04-18 21:24:47 +02:00
parent a53d94e407
commit 4f694565c3
2 changed files with 15 additions and 5 deletions

View File

@ -1,8 +1,9 @@
import dev.w1zzrd.asm.InjectClass;
import dev.w1zzrd.asm.Inject;
import static dev.w1zzrd.asm.InPlaceInjection.*;
@InjectClass(value = MergeTest.class)
public class MergeInject implements Runnable {
public class MergeInject extends MergeTest implements Runnable {
@Inject
public int number;
@ -16,10 +17,17 @@ public class MergeInject implements Runnable {
number = 10;
}
@Inject
private String test(){
@Inject(REPLACE)
public String test(){
System.out.println(s);
if(s.endsWith("e!!")) {
System.out.println("Special!");
return "ASDF";
}
System.out.println(number);
return "Modified";
}
@ -28,7 +36,9 @@ public class MergeInject implements Runnable {
public void run() {
for (int i = 0; i < 5; ++i) {
s = s + "!";
System.out.println(test());
System.out.println(test()+'\n');
}
}
public String test1(){ return null; }
}

View File

@ -5,7 +5,7 @@ import java.io.IOException;
public class Test {
public static void main(String... args) throws IOException {
Merger m = new Merger("MergeTest");
m.inject(Merger.getClassNode("MergeInject"));
m.inject("MergeInject");
m.compile();
Runnable r = (Runnable)new MergeTest("Constructor message");