PlainText extends TemplateUnit { public int chompLeadingWhitespaceToEndOfLine() { int length = leadingWhitespaceLengthToEndOfLine(); chompLeadingLength(length); return length; } PlainText(SourceRef sourceRef, String text); String getText(); PlainText combineAdjacent(PlainText other); boolean isWhitespace(); void trim(); int trailingWhitespaceLengthToStartOfLine(); int leadingWhitespaceLengthToEndOfLine(); int chompTrailingWhitespaceToStartOfLine(); void chompTrailingLength(int length); int chompLeadingWhitespaceToEndOfLine(); void chompLeadingLength(int length); SourcePosition findSourcePositionOfNonWhitespace(); static String unescape(String s);  }
@Test public void chompLeadingWhitespaceToEndOfLine() { PlainText plain; plain = new PlainText(null, "\nt"); plain.chompLeadingWhitespaceToEndOfLine(); Assert.assertEquals("t", plain.getText()); plain.chompLeadingWhitespaceToEndOfLine(); Assert.assertEquals("t", plain.getText()); plain = new PlainText(null, "\nt\n"); plain.chompLeadingWhitespaceToEndOfLine(); Assert.assertEquals("t\n", plain.getText()); plain = new PlainText(null, "\n \n"); plain.chompLeadingWhitespaceToEndOfLine(); Assert.assertEquals(" \n", plain.getText()); int length = plain.leadingWhitespaceLengthToEndOfLine(); Assert.assertEquals(6, length); plain.chompLeadingWhitespaceToEndOfLine(); Assert.assertEquals("", plain.getText()); plain = new PlainText(null, " t\n"); plain.chompLeadingWhitespaceToEndOfLine(); Assert.assertEquals(" t\n", plain.getText()); }