You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zhishifufei_php/vendor/mtdowling/jmespath.php/tests/ParserTest.php

52 lines
1.2 KiB

9 months ago
<?php
namespace JmesPath\Tests;
use JmesPath\Lexer;
use JmesPath\Parser;
use PHPUnit\Framework\TestCase;
/**
* @covers JmesPath\Parser
*/
class ParserTest extends TestCase
{
/**
* @expectedException \JmesPath\SyntaxErrorException
* @expectedExceptionMessage Syntax error at character 0
*/
public function testMatchesFirstTokens()
{
$p = new Parser(new Lexer());
$p->parse('.bar');
}
/**
* @expectedException \JmesPath\SyntaxErrorException
* @expectedExceptionMessage Syntax error at character 1
*/
public function testThrowsSyntaxErrorForInvalidSequence()
{
$p = new Parser(new Lexer());
$p->parse('a,');
}
/**
* @expectedException \JmesPath\SyntaxErrorException
* @expectedExceptionMessage Syntax error at character 2
*/
public function testMatchesAfterFirstToken()
{
$p = new Parser(new Lexer());
$p->parse('a.,');
}
/**
* @expectedException \JmesPath\SyntaxErrorException
* @expectedExceptionMessage Unexpected "eof" token
*/
public function testHandlesEmptyExpressions()
{
(new Parser(new Lexer()))->parse('');
}
}