Add basic tests
This commit is contained in:
parent
217a8b4f6f
commit
b99cc1939b
@ -4,6 +4,7 @@
|
|||||||
<exclude-output />
|
<exclude-output />
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
20
test/MergeInject.java
Normal file
20
test/MergeInject.java
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import dev.w1zzrd.asm.InjectClass;
|
||||||
|
import dev.w1zzrd.asm.Inject;
|
||||||
|
import dev.w1zzrd.asm.Merger;
|
||||||
|
|
||||||
|
@InjectClass(value = MergeTest.class)
|
||||||
|
public class MergeInject implements Runnable {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public String test(){
|
||||||
|
System.out.println(Merger.field("s"));
|
||||||
|
return "Modified";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Inject
|
||||||
|
public void run() {
|
||||||
|
for (int i = 0; i < 5; ++i)
|
||||||
|
System.out.println(test());
|
||||||
|
}
|
||||||
|
}
|
21
test/MergeTest.java
Normal file
21
test/MergeTest.java
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
public class MergeTest {
|
||||||
|
|
||||||
|
private String s = "Hello";
|
||||||
|
|
||||||
|
|
||||||
|
public MergeTest(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public MergeTest(String s) {
|
||||||
|
this.s = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String test(){
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String test1(){
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
}
|
14
test/Test.java
Normal file
14
test/Test.java
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import dev.w1zzrd.asm.Merger;
|
||||||
|
|
||||||
|
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.compile();
|
||||||
|
|
||||||
|
Runnable r = (Runnable)new MergeTest("Constructor message");
|
||||||
|
r.run();
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user