diff --git a/src/bindings/php/Tests/Many1Test.php b/src/bindings/php/Tests/Many1Test.php new file mode 100644 index 0000000..61356e7 --- /dev/null +++ b/src/bindings/php/Tests/Many1Test.php @@ -0,0 +1,31 @@ +parser = h_many1(choice(ch("a"), ch("b"))); + } + + public function testSuccess() + { + $result1 = h_parse($this->parser, "a"); + $result2 = h_parse($this->parser, "b"); + $result3 = h_parse($this->parser, "aabbaba"); + $this->assertEquals(array("a"), $result1); + $this->assertEquals(array("b"), $result2); + $this->assertEquals(array("c"), $result3); + } + + public function testFailure() + { + $result1 = h_parse($this->parser, ""); + $result2 = h_parse($this->parser, "daabbabadef"); + $this->assertEquals(NULL, $result1); + $this->assertEquals(NULL, $result2); + } +} +?> \ No newline at end of file