From eb2855dcb46fe9a462948032dae8256b02b4cf30 Mon Sep 17 00:00:00 2001
From: "Meredith L. Patterson" <mlp@thesmartpolitenerd.com>
Date: Sun, 1 Dec 2013 21:37:09 -0800
Subject: [PATCH] h_repeat_n's test is failing for the same reason as h_many

---
 src/bindings/php/Tests/RepeatNTest.php | 27 ++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 src/bindings/php/Tests/RepeatNTest.php

diff --git a/src/bindings/php/Tests/RepeatNTest.php b/src/bindings/php/Tests/RepeatNTest.php
new file mode 100644
index 00000000..e6db964e
--- /dev/null
+++ b/src/bindings/php/Tests/RepeatNTest.php
@@ -0,0 +1,27 @@
+<?php
+include_once 'hammer.php';
+
+class RepeatNTest extends PHPUnit_Framework_TestCase
+{
+    protected $parser;
+
+    protected function setUp()
+    {
+        $this->parser = h_repeat_n(choice(ch("a"), ch("b")), 2);
+    }
+
+    public function testSuccess()
+    {
+        $result = h_parse($this->parser, "abdef");
+        $this->assertEquals(array("a", "b"), $result);
+    }
+
+    public function testFailure()
+    {
+        $result1 = h_parse($this->parser, "adef");
+        $result2 = h_parse($this->parser, "dabdef");
+        $this->assertEquals(NULL, $result1);
+        $this->assertEquals(NULL, $result2);
+    }
+}
+?>
\ No newline at end of file
-- 
GitLab