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

choice isn't putting its results in the right place either

parent 1ce63c26
No related branches found
No related tags found
No related merge requests found
<?php
include_once 'hammer.php';
class ChoiceTest extends PHPUnit_Framework_TestCase
{
protected $parser;
protected function setUp()
{
$this->parser = choice(ch("a"), ch("b"));
}
public function testSuccess()
{
$result1 = h_parse($this->parser, "a");
$result2 = h_parse($this->parser, "b");
$this->assertEquals("a", $result1);
$this->assertEquals("b", $result2);
}
public function testFailure()
{
$result = h_parse($this->parser, "c");
$this->assertEquals(NULL, $result);
}
}
?>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment