Skip to content
Snippets Groups Projects
Commit 2730d9ff authored by Meredith L. Patterson's avatar Meredith L. Patterson
Browse files

fix ch_range; confirm action works with sequences too

parent 6c9410d8
No related branches found
No related tags found
No related merge requests found
......@@ -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()
{
......
......@@ -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()
{
......
......@@ -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\");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment