You are here

public function StringInputStreamTest::testCharsUnitl in Zircon Profile 8.0

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

File

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

Class

StringInputStreamTest

Namespace

Masterminds\HTML5\Tests\Parser

Code

public function testCharsUnitl() {
  $text = "abcdefffffffghi";
  $s = new StringInputStream($text);
  $this
    ->assertEquals('', $s
    ->charsUntil('a'));

  // Pointer at 'a', moves 2 to 'c'
  $this
    ->assertEquals('ab', $s
    ->charsUntil('w', 2));

  // Pointer at 'c', moves to first 'f'
  $this
    ->assertEquals('cde', $s
    ->charsUntil('fzxv'));

  // Only get five 'f's
  $this
    ->assertEquals('fffff', $s
    ->charsUntil('g', 5));

  // Get just the last two 'f's
  $this
    ->assertEquals('ff', $s
    ->charsUntil('g'));

  // This should scan to the end.
  $this
    ->assertEquals('ghi', $s
    ->charsUntil('w', 9));
}