* is properly reset now.
*/
@Test
public void bug16883() throws Exception {
// Analyze a script with broken syntax (unterminated string literal)
ShXref xref = new ShXref(new StringReader("echo \"xyz"));
StringWriter out = new StringWriter();
xref.write(out);
assertEquals(
FIRST_LINE_PREAMBLE +
"<b>echo</b> <span class=\"s\">\"xyz</span>",
out.toString());
// Reuse the xref and verify that the broken syntax in the previous
// file doesn't cause broken highlighting in the next file
out = new StringWriter();
String contents = "echo \"hello\"";
xref.reInit(contents.toCharArray(), contents.length());
xref.write(out);
assertEquals(
FIRST_LINE_PREAMBLE +
"<b>echo</b> <span class=\"s\">\"hello\"</span>",
out.toString());
}