nothing_p works; EndTest's failure case is producing an empty array (successful but empty sequence), success case is *also* producing an empty array
This commit is contained in:
parent
9f55409246
commit
fc71e12bea
2 changed files with 22 additions and 3 deletions
|
|
@ -12,15 +12,15 @@ class EndPTest extends PHPUnit_Framework_TestCase
|
|||
|
||||
public function testSuccess()
|
||||
{
|
||||
$result = h_parse($this->parser, ["a"]);
|
||||
$result = h_parse($this->parser, "a");
|
||||
var_dump($result);
|
||||
$this->assertEquals("a", $result);
|
||||
$this->assertEquals(array("a"), $result);
|
||||
}
|
||||
public function testFailure()
|
||||
{
|
||||
$result = h_parse($this->parser, "aa");
|
||||
var_dump($result);
|
||||
$this->assertEquals(NULL, $result);
|
||||
$this->assertEquals(array(), $result);
|
||||
}
|
||||
}
|
||||
?>
|
||||
19
src/bindings/php/Tests/NothingTest.php
Normal file
19
src/bindings/php/Tests/NothingTest.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
include_once 'hammer.php';
|
||||
|
||||
class NothingPTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $parser;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->parser = h_nothing_p();
|
||||
}
|
||||
|
||||
public function testFailure()
|
||||
{
|
||||
$result = h_parse($this->parser, "a");
|
||||
$this->assertEquals(NULL, $result);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue