Tests generation of inner class units.
()
| 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 | } |
nothing calls this directly
no test coverage detected