function testPeek() { $sc = new StringScanner("foobarbaz"); $this->assertEqual($sc->peek(4), "foob"); $this->assertEqual($sc->peek(0), ""); $this->assertEqual($sc->peek(9), "foobarbaz"); $this->assertEqual($sc->peek(10), "foobarbaz"); $this->assertEqual($sc->peek(5), "fooba"); $sc->pos = 3; $this->assertEqual($sc->peek(3), "bar"); $this->assertEqual($sc->peek(9), "barbaz"); $this->assertEqual($sc->peek(5), "barba"); $sc->pos = 9; $this->assertEqual($sc->peek(3), ""); }
public function testPeek() { $s = new StringScanner('test string'); $this->assertEquals("test st", $s->peek(7)); $this->assertEquals("test st", $s->peek(7)); }