示例#1
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));
   }
 }
示例#2
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());
 }
示例#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));
 }