PlainText extends TemplateUnit { public int chompTrailingWhitespaceToStartOfLine() { int length = trailingWhitespaceLengthToStartOfLine(); chompTrailingLength(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 chompTrailingWhitespaceToStartOfLine() { PlainText plain; plain = new PlainText(null, "t\n "); plain.chompTrailingWhitespaceToStartOfLine(); Assert.assertEquals("t\n", plain.getText()); plain.chompTrailingWhitespaceToStartOfLine(); Assert.assertEquals("t\n", plain.getText()); plain = new PlainText(null, " "); plain.chompTrailingWhitespaceToStartOfLine(); Assert.assertEquals("", plain.getText()); plain = new PlainText(null, "t "); plain.chompTrailingWhitespaceToStartOfLine(); Assert.assertEquals("t ", plain.getText()); plain = new PlainText(null, "\n "); plain.chompTrailingWhitespaceToStartOfLine(); Assert.assertEquals("\n", plain.getText()); }