h_repeat_n's test is failing for the same reason as h_many
This commit is contained in:
parent
eef5378f16
commit
eb2855dcb4
1 changed files with 27 additions and 0 deletions
27
src/bindings/php/Tests/RepeatNTest.php
Normal file
27
src/bindings/php/Tests/RepeatNTest.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
include_once 'hammer.php';
|
||||
|
||||
class RepeatNTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $parser;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->parser = h_repeat_n(choice(ch("a"), ch("b")), 2);
|
||||
}
|
||||
|
||||
public function testSuccess()
|
||||
{
|
||||
$result = h_parse($this->parser, "abdef");
|
||||
$this->assertEquals(array("a", "b"), $result);
|
||||
}
|
||||
|
||||
public function testFailure()
|
||||
{
|
||||
$result1 = h_parse($this->parser, "adef");
|
||||
$result2 = h_parse($this->parser, "dabdef");
|
||||
$this->assertEquals(NULL, $result1);
|
||||
$this->assertEquals(NULL, $result2);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue