From ce5a621ee3f20b082b95a36807367c8ee8edff1d Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Sat, 30 Nov 2013 17:10:24 -0800 Subject: [PATCH] h_action test is written, but something is wrong with h_choice. --- src/bindings/php/Tests/ActionTest.php | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/bindings/php/Tests/ActionTest.php diff --git a/src/bindings/php/Tests/ActionTest.php b/src/bindings/php/Tests/ActionTest.php new file mode 100644 index 0000000..699812c --- /dev/null +++ b/src/bindings/php/Tests/ActionTest.php @@ -0,0 +1,32 @@ +parser = h_action(h_sequence(h_choice(h_ch("a"), h_ch("A")), h_choice(h_ch("b"), h_ch("B"))), "actTest"); + } + public function testSuccess() + { + $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); + } + public function testFailure() + { + $result = h_parse($this->parser, "XX"); + $this->assertEquals(NULL, $result); + } +} + +?> \ No newline at end of file