Ejemplo n.º 1
0
 @Test
 public void canStartDoesNotAdvanceLineSequencePosition() {
   LineSequence lineSequence = LineSequence.create("<p\n  a=\"b\"\n>");
   Line firstLine = lineSequence.getCurrentLine();
   assertTrue(block.canStart(lineSequence, null));
   assertSame(firstLine, lineSequence.getCurrentLine());
 }
Ejemplo n.º 2
0
 private void assertCanStart(boolean expected, int type, String string) {
   assertEquals(expected, block.canStart(LineSequence.create(string), null));
   if (expected && type > 0) {
     final SourceBlockItem<?> paragraph =
         new SourceBlocks(new ParagraphBlock()).createItems(LineSequence.create("abc")).get(0);
     assertEquals(type != 7, block.canStart(LineSequence.create(string), paragraph));
   }
 }
Ejemplo n.º 3
0
 @Test
 public void canStart() {
   assertFalse(block.canStart(LineSequence.create(""), null));
   assertTrue(block.canStart(LineSequence.create("<div>"), null));
   assertTrue(block.canStart(LineSequence.create("<table>"), null));
   assertTrue(block.canStart(LineSequence.create("<p>"), null));
   assertTrue(block.canStart(LineSequence.create("<one>"), null));
   assertFalse(block.canStart(LineSequence.create("<one invalid=>"), null));
   assertFalse(block.canStart(LineSequence.create("<one> with text"), null));
   assertTrue(block.canStart(LineSequence.create("   <p>"), null));
   assertFalse(block.canStart(LineSequence.create("    <p>"), null));
   assertFalse(block.canStart(LineSequence.create("\t<p>"), null));
   assertTrue(block.canStart(LineSequence.create("<p"), null));
   assertTrue(block.canStart(LineSequence.create("<p >"), null));
   assertTrue(block.canStart(LineSequence.create("<p />"), null));
   assertTrue(block.canStart(LineSequence.create("<p/>"), null));
   assertTrue(block.canStart(LineSequence.create("<p\n  a=\"b\"\n>"), null));
 }