public function testRender()
    {
        $source = 'abc + test';
        $expected = <<<EXPECTED
<span class="token">abc</span> <span class="operator">+</span> <span class="token second">test</span>
EXPECTED;
        $first = $this->_factory->create('token', ['pos' => 0, 'length' => 3]);
        $operator = $this->_factory->create('operator', ['pos' => 4, 'length' => 1]);
        $second = $this->_factory->create('token.second', ['pos' => 6, 'length' => 4]);
        $iterator = new Result($source);
        $iterator->merge([$first, $first->getEnd(), $operator, $operator->getEnd(), $second, $second->getEnd()]);
        $formatter = new HtmlFormatter();
        $this->assertEquals($expected, $formatter->format($iterator));
    }
 public function testSingleton()
 {
     $formatter = new HtmlFormatter();
     $language = new MockGreedyLanguage(['rules' => ['keyword' => new Rule(new SubStringMatcher('if'))]]);
     $this->assertEquals($formatter->format($language->parse('if test')), KeyLighter::get()->highlight('if test', $language, $formatter));
 }