diff options
author | Matt Farina <[email protected]> | 2013-04-10 11:58:40 -0400 |
---|---|---|
committer | Matt Farina <[email protected]> | 2013-04-10 11:58:48 -0400 |
commit | 734464d5194b7a7ada25376955859b0d3a608ab1 (patch) | |
tree | 598d3f16d4af471422638baf26eae68ced4e53e7 /test/HTML5/ScannerTest.php | |
parent | eb0ea976ffc57aa3701e3e4cf6ce18375e9d10c2 (diff) |
Moved the scanner to the new string input parser. The current test will fail until the parser is updated to handle positioning correctly.
Diffstat (limited to 'test/HTML5/ScannerTest.php')
-rw-r--r-- | test/HTML5/ScannerTest.php | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/test/HTML5/ScannerTest.php b/test/HTML5/ScannerTest.php index 696b10e..8c341fa 100644 --- a/test/HTML5/ScannerTest.php +++ b/test/HTML5/ScannerTest.php @@ -5,7 +5,7 @@ */ namespace HTML5\Tests; -use \HTML5\InputStream; +use \HTML5\Parser\StringInputStream; use \HTML5\Parser\Scanner; require_once 'TestCase.php'; @@ -16,14 +16,14 @@ class ScannerTest extends TestCase { * A canary test to make sure the basics are setup and working. */ public function testConstruct() { - $is = new InputStream("abc"); + $is = new StringInputStream("abc"); $s = new Scanner($is); $this->assertInstanceOf('\HTML5\Parser\Scanner', $s); } public function testNext() { - $s = new Scanner(new InputStream("abc")); + $s = new Scanner(new StringInputStream("abc")); $this->assertEquals('a', $s->next()); $this->assertEquals('b', $s->next()); @@ -31,7 +31,7 @@ class ScannerTest extends TestCase { } public function testPosition() { - $s = new Scanner(new InputStream("abc")); + $s = new Scanner(new StringInputStream("abc")); $this->assertEquals(0, $s->position()); @@ -40,7 +40,7 @@ class ScannerTest extends TestCase { } public function testPeek() { - $s = new Scanner(new InputStream("abc")); + $s = new Scanner(new StringInputStream("abc")); // The scanner is currently pointed before a. $this->assertEquals('b', $s->peek()); @@ -50,21 +50,21 @@ class ScannerTest extends TestCase { } public function testCurrent() { - $s = new Scanner(new InputStream("abc")); + $s = new Scanner(new StringInputStream("abc")); // Before scanning the string begins the current is empty. - $this->assertEquals('', $s->current()); + $this->assertEquals('a', $s->current()); $c = $s->next(); - $this->assertEquals($c, $s->current()); + $this->assertEquals('b', $s->current()); // Test movement through the string. $c = $s->next(); - $this->assertEquals($c, $s->current()); + $this->assertEquals('c', $s->current()); } public function testUnconsume() { - $s = new Scanner(new InputStream("abcdefghijklmnopqrst")); + $s = new Scanner(new StringInputStream("abcdefghijklmnopqrst")); // Get initial position. $s->next(); @@ -83,7 +83,7 @@ class ScannerTest extends TestCase { } public function testGetHex() { - $s = new Scanner(new InputStream("ab13ck45DE*")); + $s = new Scanner(new StringInputStream("ab13ck45DE*")); $this->assertEquals('ab13c', $s->getHex()); @@ -92,7 +92,7 @@ class ScannerTest extends TestCase { } public function testGetAsciiAlpha() { - $s = new Scanner(new InputStream("abcdef1%mnop*")); + $s = new Scanner(new StringInputStream("abcdef1%mnop*")); $this->assertEquals('abcdef', $s->getAsciiAlpha()); @@ -103,7 +103,7 @@ class ScannerTest extends TestCase { } public function testGetAsciiAlphaNum() { - $s = new Scanner(new InputStream("abcdef1ghpo#mn94op")); + $s = new Scanner(new StringInputStream("abcdef1ghpo#mn94op")); $this->assertEquals('abcdef1ghpo', $s->getAsciiAlphaNum()); @@ -113,7 +113,7 @@ class ScannerTest extends TestCase { } public function testGetNumeric() { - $s = new Scanner(new InputStream("1784a 45 9867 #")); + $s = new Scanner(new StringInputStream("1784a 45 9867 #")); $this->assertEquals('1784', $s->getNumeric()); |