Exemple #1
0
 /** Tests {@link TextInput#skipBackToBeginOfXmlTag()}. */
 public void testSkipBackToBeginOfXmlTag() {
   final TextInput ti = new TextInput("hiso \"<\"hiso >goto blub > &");
   ti.setPosition(300);
   try {
     ti.skipBackToBeginOfXmlTag();
     fail("Exception expected");
   } catch (RuntimeException e) {
     // OK
   }
   final String first = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
   qedeqInput.setPosition(first.length());
   qedeqInput.skipBackToBeginOfXmlTag();
   assertEquals(0, qedeqInput.getPosition());
   qedeqInput.setPosition(first.length() + 1);
   qedeqInput.skipWhiteSpace();
   // now we are at "<"
   final int pos = qedeqInput.getPosition();
   qedeqInput.skipBackToBeginOfXmlTag();
   assertEquals(pos, qedeqInput.getPosition());
   qedeqInput.readInverse();
   // now we are just before "<"
   qedeqInput.skipBackToBeginOfXmlTag();
   assertEquals(0, qedeqInput.getPosition());
   final TextInput ti2 = new TextInput("we will test if this is working");
   ti2.setPosition(300);
   try {
     ti2.skipBackToBeginOfXmlTag();
     fail("Exception expected");
   } catch (RuntimeException e) {
     // OK
   }
 }
Exemple #2
0
 public void testSkipToEndOfLine() {
   qedeqInput.skipToEndOfLine();
   assertEquals('\n', qedeqInput.readInverse());
   final TextInput ti = new TextInput("\n\n\n\n");
   ti.skipToEndOfLine();
   assertEquals(1, ti.getPosition());
   ti.skipToEndOfLine();
   assertEquals(2, ti.getPosition());
   ti.skipToEndOfLine();
   assertEquals(3, ti.getPosition());
   ti.skipToEndOfLine();
   assertEquals(4, ti.getPosition());
   ti.skipToEndOfLine();
   assertEquals(4, ti.getPosition());
 }
Exemple #3
0
 /** Test {@link TextInput#readInverse()}. */
 public void testReadInverse() {
   assertEquals(-1, qedeqInput.readInverse());
   assertEquals('<', qedeqInput.read());
   assertEquals('<', qedeqInput.readInverse());
 }