From 378710844bdbd4d5c01b8a7e6c665e2862b42bb3 Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" Date: Sun, 1 Dec 2013 21:18:33 -0800 Subject: [PATCH] h_butnot is fine --- src/bindings/php/Tests/ButNotTest.php | 35 +++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/bindings/php/Tests/ButNotTest.php diff --git a/src/bindings/php/Tests/ButNotTest.php b/src/bindings/php/Tests/ButNotTest.php new file mode 100644 index 0000000..9f8117a --- /dev/null +++ b/src/bindings/php/Tests/ButNotTest.php @@ -0,0 +1,35 @@ +parser1 = h_butnot(ch("a"), h_token("ab")); + $this->parser2 = h_butnot(h_ch_range('0', '9'), ch('6')); + } + + public function testSuccess1() + { + $result1 = h_parse($this->parser1, "a"); + $result2 = h_parse($this->parser1, "aa"); + $this->assertEquals("a", $result1); + $this->assertEquals("a", $result1); + } + + public function testFailure1() + { + $result = h_parse($this->parser1, "ab"); + $this->assertEquals(NULL, $result); + } + + public function testFailure2() + { + $result = h_parse($this->parser2, "6"); + $this->assertEquals(NULL, $result); + } +} +?> \ No newline at end of file