Пример #1
0
 // This one currently fails with InputStreamLexerSource
 public void testCarriageReturnsShouldBeUnreadAutomatically() throws IOException {
   LexerSource src = newSource("abc\r\ndef");
   assertReadShouldProduce(src, "abc\ndef");
   assertEquals(8, src.getOffset());
   src.unreadMany("\ndef");
   assertEquals(3, src.getOffset());
   src.read();
   assertEquals(5, src.getOffset());
   assertReadShouldProduce(src, "def");
 }
Пример #2
0
 @SuppressWarnings("empty-statement")
 public void testLinesAndOffsetsAreReported() throws IOException {
   LexerSource src = newSource("a\nb\nc\nd\n");
   while (src.read() != RubyLexer.EOF) ;
   assertEquals(4, src.getLine());
   assertEquals(8, src.getOffset());
 }
Пример #3
0
 public void testCarriageReturnsShouldBeEaten() {
   LexerSource src = newSource("abcd\r\n");
   assertReadShouldProduce(src, "abcd\n");
   assertEquals(6, src.getOffset());
 }