diff --git a/src/bindings/php/Tests/ActionTest.php b/src/bindings/php/Tests/ActionTest.php index ee8f0cf0c28cf0c34a11a6a466c056f5a45beb7a..2912533a10e7880f426f663c772c373054b70531 100644 --- a/src/bindings/php/Tests/ActionTest.php +++ b/src/bindings/php/Tests/ActionTest.php @@ -4,7 +4,10 @@ include_once 'hammer.php'; function actTest($token) { if (is_array($token) === true) { - return strtoupper(join('', $token)); + foreach($token as $chr) { + $ret[] = strtoupper($chr); + } + return $ret; } else { return strtoupper($token); } @@ -23,9 +26,9 @@ class ActionTest extends PHPUnit_Framework_TestCase $result1 = h_parse($this->parser, "ab"); $result2 = h_parse($this->parser, "AB"); $result3 = h_parse($this->parser, "aB"); - $this->assertEquals("AB", $result1); - $this->assertEquals("AB", $result2); - $this->assertEquals("AB", $result3); + $this->assertEquals(["A", "B"], $result1); + $this->assertEquals(["A", "B"], $result2); + $this->assertEquals(["A", "B"], $result3); } public function testFailure() { diff --git a/src/bindings/php/Tests/ChRangeTest.php b/src/bindings/php/Tests/ChRangeTest.php index b726a5dca7f2883a97db94b7540236e18b7a8d23..433c2cea7f38e39fcbe42c02ff2a183dd7956bd6 100644 --- a/src/bindings/php/Tests/ChRangeTest.php +++ b/src/bindings/php/Tests/ChRangeTest.php @@ -8,7 +8,7 @@ class ChRangeTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = h_ch_range("a", "c"); + $this->parser = ch_range("a", "c"); } public function testSuccess() { diff --git a/src/bindings/php/hammer.i b/src/bindings/php/hammer.i index a5be96edbc66e9daa0fe08ad486c0d9534d62923..174cb9806c2f5fdfe0b86a0652f33d091331f425 100644 --- a/src/bindings/php/hammer.i +++ b/src/bindings/php/hammer.i @@ -175,6 +175,11 @@ function sequence() return h_sequence__a($arg_list); } +function ch_range($low, $high) +{ + return action(h_ch_range($low, $high), \"chr\"); +} + function in($charset) { return action(h_in($charset), \"chr\");