Beispiel #1
0
 function testGetChar()
 {
     $sc = new StringScanner("foo");
     $this->assertTrue($sc->isBol());
     $this->assertFalse($sc->isEos());
     $this->assertEqual($sc->getChar(), "f");
     $this->assertEqual($sc->pos, 1);
     $this->assertFalse($sc->isBol());
     $this->assertFalse($sc->isEos());
     $this->assertEqual($sc->getChar(), "o");
     $this->assertEqual($sc->pos, 2);
     $this->assertFalse($sc->isBol());
     $this->assertFalse($sc->isEos());
     $this->assertEqual($sc->getChar(), "o");
     $this->assertEqual($sc->pos, 3);
     $this->assertFalse($sc->isBol());
     $this->assertTrue($sc->isEos());
     $this->assertEqual($sc->getChar(), null);
     $this->assertTrue($sc->isEos());
     $this->assertEqual($sc->getChar(), null);
     $this->assertTrue($sc->isEos());
 }