@Test public void testCharLiterals() throws Exception {
ST st = new ST(
"Foo <\\n><\\n><\\t> bar\n"
);
StringWriter sw = new StringWriter();
st.write(new AutoIndentWriter(sw,"\n")); // force \n as newline
String result = sw.toString();
String expecting ="Foo \n\n\t bar\n"; // expect \n in output
assertEquals(expecting, result);
st = new ST(
"Foo <\\n><\\t> bar" +newline);
sw = new StringWriter();
st.write(new AutoIndentWriter(sw,"\n")); // force \n as newline
expecting ="Foo \n\t bar\n"; // expect \n in output
result = sw.toString();
assertEquals(expecting, result);
st = new ST(
"Foo<\\ >bar<\\n>");
sw = new StringWriter();
st.write(new AutoIndentWriter(sw,"\n")); // force \n as newline
result = sw.toString();
expecting ="Foo bar\n"; // forced \n
assertEquals(expecting, result);
}