diff --git a/src/bindings/php/Tests/ButNotTest.php b/src/bindings/php/Tests/ButNotTest.php new file mode 100644 index 0000000000000000000000000000000000000000..9f8117a3de9f0be9b0892715ad2a65573d5e60a2 --- /dev/null +++ b/src/bindings/php/Tests/ButNotTest.php @@ -0,0 +1,35 @@ +<?php +include_once 'hammer.php'; + +class ButNotTest extends PHPUnit_Framework_TestCase +{ + protected $parser1; + protected $parser2; + + protected function setUp() + { + $this->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