TreeEmitter { private TreeEmitter() { } private  TreeEmitter(); static String get(Instruction inst); static void emit(Instruction inst, int depth, StringBuilder buf);  }
@Test public void testTreeEmitter() throws CodeException { String raw = GeneralUtils.loadResource(TreeEmitterTest.class, "tree-emitter.txt"); Map<String, String> sections = TestCaseParser.parseSections(raw); String input = sections.get("INPUT").trim(); String expected = sections.get("EXPECTED").trim(); Instruction inst = compiler().compile(input, false, false).code(); String actual = TreeEmitter.get(inst).trim(); if (!actual.equals(expected)) { throw new AssertionError("Output does not match:\n" + TestCaseParser.diff(expected, actual)); } }