From 778d1aed9d277fd000b97e297eff8af8d5d8af97 Mon Sep 17 00:00:00 2001 From: Gabriel Tofvesson Date: Tue, 21 Apr 2020 18:16:48 +0200 Subject: [PATCH] Update tests --- .idea/compiler.xml | 8 ++++++++ out.class | Bin 0 -> 1794 bytes test/MergeInject.java | 12 ++++++++++-- test/Test.java | 12 ++++++++++++ 4 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 .idea/compiler.xml create mode 100644 out.class diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..356f474 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/out.class b/out.class new file mode 100644 index 0000000000000000000000000000000000000000..ba6065bd7627b6a9d895172977dea214ff99c73c GIT binary patch literal 1794 zcmZ`(TUQ%Z6#h;U$PfkyLn*CAO}x|)q_J9W1*G9xYzRnbYVkTGr{U0HCTlXm)%xn6 z@YR>TT9!@M(zSf>(VwJU>UT2X*3_((bJ=I_Z-4tXfBy69?*OjhzChoa^lNfUHi9^W zKyuGMuyc;>)^h7Rd$K}lRKPlsZZ=)l-f?6cJpzNr##gk4fM`&;aH3rbeC5`r1$y1) z{*Lsiu_`cDsLF%fcUK=i^s70$v7cLYwJWVQqg)kyA~2fiMwuuJL^Bg*69X7ZAcmv~ z1ATpnz!HcByNcfX3&)&@*Ap%BPKWf^2&Wn{q#4Hzl4kggJ1W@ypHA5}F^`1= z@>moYDAi>}*-olrH)PttGDSr)T=S~xo|4r$12>tGd}(pnz^5$a(gXes6qsp7QMMfe zMMh6r1~%xtgU1`o9m}lhmYl|xrhl8yN4N&=F!H?X1-sHusdkUERdh=3au7H!QNQW( zM4+!sysWby!8ZcqnT76lJzYgxmuZKVO5h?VGEn=ntQv}QnRn^W4(Nx&5L@u7>|U$j zRcxnh`$|vlmRHT{ZQR*poP%wk|dxLbPabg$}p z;VOCV*~upudCXe`HLmBw7o5W=Z`5g{3heSc2t5mW z#QW*VB-(k5bue?>1z&rzzhLBN9zr;+q}_*b8bnh9M)>FFf?AqTj=Po)lhB2%^%5Cn zlZhu7*StiVR|quR0XiL<&?O3iM1%}uv^o3@m+wBsTbfJ@lhzcM7Tzfw;)BkM^$|ss zX>kj)lh#}dOFv?m8rBL0)@tDqO4coHVy$VxdXYy0&014OCkjFjvwE{WJAo)^y<3Dx zhC1Udl&#NC``7 zbyX(b2;q`62LGhQzS^u628g?-{bIJG#bJ^#T_H~#Y7K1Syy|wTy#mPhq rl`wNZ2=VCOKh8E#gcDwEHzCnGq%~27@eC317jB&CPJul>MiBoGW0HSB literal 0 HcmV?d00001 diff --git a/test/MergeInject.java b/test/MergeInject.java index c38515c..ab9a3fb 100644 --- a/test/MergeInject.java +++ b/test/MergeInject.java @@ -1,5 +1,6 @@ import dev.w1zzrd.asm.InjectClass; import dev.w1zzrd.asm.Inject; + import static dev.w1zzrd.asm.InPlaceInjection.*; @InjectClass(value = MergeTest.class) @@ -27,12 +28,15 @@ public class MergeInject extends MergeTest implements Runnable { public String test(String retVal){ System.out.println("Got retval: "+retVal); - if (retVal.equals("Test")) { - System.out.println("Test"); + if (retVal.endsWith("e!!Test")) { + System.out.println("Special case!"); + return "Not Modified?"; } retVal = "ASDF"; + System.out.println("Eyyyy"); + String a = "retVal"; System.out.println(a); @@ -63,6 +67,10 @@ public class MergeInject extends MergeTest implements Runnable { + + + + @Override @Inject public void run() { diff --git a/test/Test.java b/test/Test.java index 9c4456e..13ccc6c 100644 --- a/test/Test.java +++ b/test/Test.java @@ -1,11 +1,23 @@ import dev.w1zzrd.asm.Merger; +import java.io.File; +import java.io.FileOutputStream; import java.io.IOException; public class Test { public static void main(String... args) throws IOException { Merger m = new Merger("MergeTest"); m.inject("MergeInject"); + + // Save injected data + File f = new File("out.class"); + if(f.isFile() && f.delete() && f.createNewFile()) { + FileOutputStream fos = new FileOutputStream(f); + fos.write(m.toByteArray()); + fos.close(); + } + + // Compile and run m.compile(); Runnable r = (Runnable)new MergeTest("Constructor message");