MCPcopy Index your code
hub / github.com/Col-E/Recaf / testDebug

Method testDebug

src/test/java/me/coley/recaf/CompilerTest.java:55–86  ·  view source on GitHub ↗

Tests generation of inner class units.

()

Source from the content-addressed store, hash-verified

53 * Tests generation of inner class units.
54 */
55 @Test
56 public void testDebug() {
57 // source code
58 StringBuilder s = new StringBuilder();
59 s.append("public class HelloWorld {" +
60 " public static void main(String args[])" +
61 " {" +
62 " String a = \"Hello \";" +
63 " String b = \"World!\";" +
64 " System.out.print(a + b);" +
65 " }" +
66 "}");
67 // create the compilers, add the code
68 JavacCompiler cDebug = new JavacCompiler();
69 cDebug.addUnit("HelloWorld", s.toString());
70 cDebug.options().lineNumbers = true;
71 cDebug.options().variables = true;
72 cDebug.options().sourceName = true;
73 cDebug.options().setTarget(JavacTargetVersion.V8);
74 cDebug.setCompileListener(FAIL_ON_ERROR);
75 assertTrue(cDebug.compile());
76 JavacCompiler cNone = new JavacCompiler();
77 cNone.addUnit("HelloWorld", s.toString());
78 cNone.setCompileListener(FAIL_ON_ERROR);
79 assertTrue(cNone.compile());
80 // compiled code
81 byte[] debug = cDebug.getUnitCode("HelloWorld");
82 byte[] nodebug = cNone.getUnitCode("HelloWorld");
83 assertNotNull(debug);
84 assertNotNull(nodebug);
85 assertTrue(debug.length > nodebug.length);
86 }
87}

Callers

nothing calls this directly

Calls 8

addUnitMethod · 0.95
optionsMethod · 0.95
setCompileListenerMethod · 0.95
compileMethod · 0.95
getUnitCodeMethod · 0.95
appendMethod · 0.80
setTargetMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected