diff options
author | Matt Farina <[email protected]> | 2013-04-10 17:02:56 -0400 |
---|---|---|
committer | Matt Farina <[email protected]> | 2013-04-10 17:02:56 -0400 |
commit | 6be90aec47b62d16b2264dd6be04b493dfe23364 (patch) | |
tree | d67740e264cf767fd1ad17cacc9c6f5f4d3bae7f /test/HTML5/Parser | |
parent | 8823b54d3bc4fe9e8dafdfceede85c4a7eb58772 (diff) |
Rounded out the Scanner tests.
Diffstat (limited to 'test/HTML5/Parser')
-rw-r--r-- | test/HTML5/Parser/ScannerTest.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/HTML5/Parser/ScannerTest.php b/test/HTML5/Parser/ScannerTest.php index ad936df..1c9b009 100644 --- a/test/HTML5/Parser/ScannerTest.php +++ b/test/HTML5/Parser/ScannerTest.php @@ -121,4 +121,34 @@ class ScannerTest extends \HTML5\Tests\TestCase { $s->next(); $this->assertEquals('45', $s->getNumeric()); } + + public function testCurrentLine() { + $s = new Scanner(new StringInputStream("1784a\n45\n9867 #\nThis is a test.")); + + $this->assertEquals(1, $s->currentLine()); + + // Move to the next line. + $s->getAsciiAlphaNum(); $s->next(); + $this->assertEquals(2, $s->currentLine()); + } + + public function testColumnOffset() { + $s = new Scanner(new StringInputStream("1784a a\n45 9867 #\nThis is a test.")); + + // Move the pointer to the space. + $s->getAsciiAlphaNum(); + $this->assertEquals(5, $s->columnOffset()); + + // We move the pointer ahead. There must be a better way to do this. + $s->next(); $s->next(); $s->next(); $s->next(); $s->next(); $s->next(); + $this->assertEquals(3, $s->columnOffset()); + } + + public function testRemainingChars() { + $string = "\n45\n9867 #\nThis is a test."; + $s = new Scanner(new StringInputStream("1784a\n45\n9867 #\nThis is a test.")); + + $s->getAsciiAlphaNum(); + $this->assertEquals($string, $s->remainingChars()); + } }
\ No newline at end of file |