@Test
public void testBlock() {

    CodeOutput output = new CodeOutput();
    output.println("a");
    output.indent();
    output.println("b");
    CodeBlock block = output.block();
    output.dedent();
    output.println("c");
    block.println("{");
    block.indent();
    block.println("a2");
    CodeBlock more = block.block();
    block.println("a3");
    block.dedent();
    block.println("}");
    more.println("d1");
    Assert.assertEquals(output.toString(), "a\n   b\n   {\n      a2\n      d1\n      a3\n   }\nc\n");
}