use of com.redhat.ceylon.common.tool.WordWrap in project ceylon-compiler by ceylon.
the class PlaintextTests method renderAndCompare.
public void renderAndCompare(String mdFile, String txtFile) throws Exception {
StringWriter sw = new StringWriter();
try (InputStreamReader stream = new InputStreamReader(PlaintextTests.class.getResourceAsStream(mdFile))) {
Parser parser = new Parser(stream);
Document document = parser.parse();
PlaintextMarkdownVisitor emitter = new PlaintextMarkdownVisitor(new WordWrap(sw));
document.accept(emitter);
}
StringBuilder sb = new StringBuilder();
try (BufferedReader r = new BufferedReader(new InputStreamReader(PlaintextTests.class.getResourceAsStream(txtFile)))) {
String line = r.readLine();
while (line != null) {
sb.append(line).append("\n");
line = r.readLine();
}
}
Assert.assertEquals(sb.toString(), sw.toString().replace("\r\n", "\n"));
}
Aggregations