h_many is failing because of the problem with choice not returning results correctly
This commit is contained in:
parent
a10572e751
commit
e9de06636d
1 changed files with 25 additions and 0 deletions
25
src/bindings/php/Tests/ManyTest.php
Normal file
25
src/bindings/php/Tests/ManyTest.php
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
include_once 'hammer.php';
|
||||
|
||||
class ManyTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $parser;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->parser = h_many(choice(ch("a"), ch("b")));
|
||||
}
|
||||
|
||||
public function testSuccess()
|
||||
{
|
||||
$result1 = h_parse($this->parser, "");
|
||||
$result2 = h_parse($this->parser, "a");
|
||||
$result3 = h_parse($this->parser, "b");
|
||||
$result4 = h_parse($this->parser, "aabbaba");
|
||||
$this->assertEquals(array(), $result);
|
||||
$this->assertEquals(array("a"), $result);
|
||||
$this->assertEquals(array("b"), $result);
|
||||
$this->assertEquals(array("a", "a", "b", "b", "a", "b", "a"), $result);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue