From fc71e12beaf0b64cd80b84a5af1de305eb833869 Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" <mlp@thesmartpolitenerd.com> Date: Sun, 1 Dec 2013 21:04:54 -0800 Subject: [PATCH] nothing_p works; EndTest's failure case is producing an empty array (successful but empty sequence), success case is *also* producing an empty array --- src/bindings/php/Tests/EndTest.php | 6 +++--- src/bindings/php/Tests/NothingTest.php | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 src/bindings/php/Tests/NothingTest.php diff --git a/src/bindings/php/Tests/EndTest.php b/src/bindings/php/Tests/EndTest.php index 0b7ef429..53955ed4 100644 --- a/src/bindings/php/Tests/EndTest.php +++ b/src/bindings/php/Tests/EndTest.php @@ -12,15 +12,15 @@ class EndPTest extends PHPUnit_Framework_TestCase public function testSuccess() { - $result = h_parse($this->parser, ["a"]); + $result = h_parse($this->parser, "a"); var_dump($result); - $this->assertEquals("a", $result); + $this->assertEquals(array("a"), $result); } public function testFailure() { $result = h_parse($this->parser, "aa"); var_dump($result); - $this->assertEquals(NULL, $result); + $this->assertEquals(array(), $result); } } ?> \ No newline at end of file diff --git a/src/bindings/php/Tests/NothingTest.php b/src/bindings/php/Tests/NothingTest.php new file mode 100644 index 00000000..fa31b55a --- /dev/null +++ b/src/bindings/php/Tests/NothingTest.php @@ -0,0 +1,19 @@ +<?php +include_once 'hammer.php'; + +class NothingPTest extends PHPUnit_Framework_TestCase +{ + protected $parser; + + protected function setUp() + { + $this->parser = h_nothing_p(); + } + + public function testFailure() + { + $result = h_parse($this->parser, "a"); + $this->assertEquals(NULL, $result); + } +} +?> \ No newline at end of file -- GitLab