ParserTest.php
1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
namespace JmesPath\Tests;
use JmesPath\Lexer;
use JmesPath\Parser;
/**
* @covers JmesPath\Parser
*/
class ParserTest extends \PHPUnit_Framework_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('');
}
}