From 2730d9ffd73d4b963f629a4db9fad8c02eebfceb Mon Sep 17 00:00:00 2001
From: "Meredith L. Patterson" <mlp@thesmartpolitenerd.com>
Date: Mon, 16 Dec 2013 13:18:54 +0100
Subject: [PATCH] fix ch_range; confirm action works with sequences too

---
 src/bindings/php/Tests/ActionTest.php  | 11 +++++++----
 src/bindings/php/Tests/ChRangeTest.php |  2 +-
 src/bindings/php/hammer.i              |  5 +++++
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/bindings/php/Tests/ActionTest.php b/src/bindings/php/Tests/ActionTest.php
index ee8f0cf0..2912533a 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 b726a5dc..433c2cea 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 a5be96ed..174cb980 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\");
-- 
GitLab