Fixed sequence, choice, h_in and h_not_in. ChRange needs its output coerced to char and we're good.

This commit is contained in:
Meredith L. Patterson 2013-12-10 00:53:35 +01:00
parent 4735d17908
commit a09bd53286
6 changed files with 33 additions and 26 deletions

View file

@ -11,13 +11,23 @@ class LeftrecTest extends PHPUnit_Framework_TestCase
h_bind_indirect($this->parser, choice(sequence($this->parser, ch("a")), ch("a")));
}
public function testSuccess()
public function testSuccess1()
{
$result1 = h_parse($this->parser, "a");
$result2 = h_parse($this->parser, "aa");
$result3 = h_parse($this->parser, "aaa");
$this->assertEquals("a", $result1);
$result = h_parse($this->parser, "a");
$this->assertEquals("a", $result);
}
public function testSuccess2()
{
$result = h_parse($this->parser, "aa");
var_dump($result);
$this->assertEquals(array("a", "a"), $result);
}
public function testSuccess3()
{
$result = h_parse($this->parser, "aaa");
var_dump($result);
$this->assertEquals(array(array("a", "a"), "a"), $result);
}
}