You are here

public function StringInputStreamTest::testColumnOffset in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/masterminds/html5/test/HTML5/Parser/StringInputStreamTest.php \Masterminds\HTML5\Tests\Parser\StringInputStreamTest::testColumnOffset()

File

vendor/masterminds/html5/test/HTML5/Parser/StringInputStreamTest.php, line 64

Class

StringInputStreamTest

Namespace

Masterminds\HTML5\Tests\Parser

Code

public function testColumnOffset() {
  $s = new StringInputStream("abc\ndef\n");
  $this
    ->assertEquals(0, $s
    ->columnOffset());
  $s
    ->next();
  $this
    ->assertEquals(1, $s
    ->columnOffset());
  $s
    ->next();
  $this
    ->assertEquals(2, $s
    ->columnOffset());
  $s
    ->next();
  $this
    ->assertEquals(3, $s
    ->columnOffset());
  $s
    ->next();

  // LF
  $this
    ->assertEquals(0, $s
    ->columnOffset());
  $s
    ->next();
  $canary = $s
    ->current();

  // e
  $this
    ->assertEquals('e', $canary);
  $this
    ->assertEquals(1, $s
    ->columnOffset());
  $s = new StringInputStream("abc");
  $this
    ->assertEquals(0, $s
    ->columnOffset());
  $s
    ->next();
  $this
    ->assertEquals(1, $s
    ->columnOffset());
  $s
    ->next();
  $this
    ->assertEquals(2, $s
    ->columnOffset());
}