h_butnot is fine
This commit is contained in:
parent
80d4460e6e
commit
378710844b
1 changed files with 35 additions and 0 deletions
35
src/bindings/php/Tests/ButNotTest.php
Normal file
35
src/bindings/php/Tests/ButNotTest.php
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
include_once 'hammer.php';
|
||||
|
||||
class ButNotTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $parser1;
|
||||
protected $parser2;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->parser1 = h_butnot(ch("a"), h_token("ab"));
|
||||
$this->parser2 = h_butnot(h_ch_range('0', '9'), ch('6'));
|
||||
}
|
||||
|
||||
public function testSuccess1()
|
||||
{
|
||||
$result1 = h_parse($this->parser1, "a");
|
||||
$result2 = h_parse($this->parser1, "aa");
|
||||
$this->assertEquals("a", $result1);
|
||||
$this->assertEquals("a", $result1);
|
||||
}
|
||||
|
||||
public function testFailure1()
|
||||
{
|
||||
$result = h_parse($this->parser1, "ab");
|
||||
$this->assertEquals(NULL, $result);
|
||||
}
|
||||
|
||||
public function testFailure2()
|
||||
{
|
||||
$result = h_parse($this->parser2, "6");
|
||||
$this->assertEquals(NULL, $result);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue