diff --git a/src/bindings/php/Tests/EndTest.php b/src/bindings/php/Tests/EndTest.php index 55e05b82ff2e40759ae696485c39113769c4627c..92e4965019d36b1802e52fdda6d1b2aa3eb3e733 100644 --- a/src/bindings/php/Tests/EndTest.php +++ b/src/bindings/php/Tests/EndTest.php @@ -12,17 +12,13 @@ class EndPTest extends PHPUnit_Framework_TestCase public function testSuccess() { - echo 'in testSuccess\n'; -// $result = h_parse($this->parser, "a"); - // TODO: fixme when h_ch is fixed -// $this->assertEquals(98, $result); + $result = h_parse($this->parser, "a"); + $this->assertEquals("a", $result); } -/* public function testFailure() { $result = h_parse($this->parser, "aa"); $this->assertEquals(NULL, $result); } -*/ } ?> \ No newline at end of file diff --git a/src/bindings/swig/hammer.i b/src/bindings/swig/hammer.i index be69675101aa147c490516c28531a00f6cc2058b..eb6428a55ca2d2ded3a424ca40ca589ad2317877 100644 --- a/src/bindings/swig/hammer.i +++ b/src/bindings/swig/hammer.i @@ -549,22 +549,18 @@ function ch($ch) return h_ch($ch); } +function choice() +{ + $arg_list = func_get_args(); + $arg_list[] = NULL; + return h_choice__a($arg_list); +} + function sequence() { - echo 'in sequence\n'; - $numargs = func_num_args(); $arg_list = func_get_args(); - var_dump($arg_list); - for ($i = 0; $i < $numargs; $i++) - { - var_dump($arg_list[$i] instanceof _p_HParser_); - if (! $arg_list[$i] instanceof _p_HParser_) - { - echo 'PHP says that is not an HParser!'; - return NULL; - } - } - //return hammer::h_sequence__a($arg_list); + $arg_list[] = NULL; + return h_sequence__a($arg_list); } " #endif