Search in sources :

Example 11 with RecordingDocumentBuilder

use of org.eclipse.mylyn.wikitext.toolkit.RecordingDocumentBuilder in project mylyn.docs by eclipse.

the class MediaWikiLanguageTest method testTableIncomplete.

@Test
public void testTableIncomplete() {
    final RecordingDocumentBuilder builder = new RecordingDocumentBuilder();
    parser.setBuilder(builder);
    final String content = "{|\n" + "|  Orange    ||   Apple   ||   more\n" + "|-\n" + "|   Bread    ||   Pie     ||   more\n" + "|-\n" + "|   Butter   || Ice cream ||  and more\n" + "| \n";
    parser.parse(content);
    for (RecordingDocumentBuilder.Event event : builder.getEvents()) {
        if (event.text != null) {
            int start = event.locator.getDocumentOffset();
            int end = event.locator.getLineSegmentEndOffset() + event.locator.getLineDocumentOffset();
            assertEquals(event.text.length(), end - start);
            assertTrue(end >= start);
            assertEquals(content.substring(start, end), event.text);
        }
    }
}
Also used : RecordingDocumentBuilder(org.eclipse.mylyn.wikitext.toolkit.RecordingDocumentBuilder) AbstractMarkupGenerationTest(org.eclipse.mylyn.wikitext.toolkit.AbstractMarkupGenerationTest) Test(org.junit.Test)

Aggregations

RecordingDocumentBuilder (org.eclipse.mylyn.wikitext.toolkit.RecordingDocumentBuilder)11 Test (org.junit.Test)9 AbstractMarkupGenerationTest (org.eclipse.mylyn.wikitext.toolkit.AbstractMarkupGenerationTest)8 Event (org.eclipse.mylyn.wikitext.toolkit.RecordingDocumentBuilder.Event)4 MarkupParser (org.eclipse.mylyn.wikitext.parser.MarkupParser)1