From cafa9adb1a1d2dc1fdfecf2be8d407bb2c44b083 Mon Sep 17 00:00:00 2001
From: Dan Hirsch <thequux@upstandinghackers.com>
Date: Sat, 11 Jan 2014 03:28:31 +0100
Subject: [PATCH] Action works, too

---
 src/bindings/ruby/test/parser_test.rb | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/bindings/ruby/test/parser_test.rb b/src/bindings/ruby/test/parser_test.rb
index a8b9c7b8..6bbdc366 100644
--- a/src/bindings/ruby/test/parser_test.rb
+++ b/src/bindings/ruby/test/parser_test.rb
@@ -112,3 +112,21 @@ class AttrBoolTest < Minitest::Test
     refute_parse_ok @parser, "ab"
   end
 end
+
+class ActionTest < Minitest::Test
+  def setup
+    h = Hammer::Parser
+    @parser = h.action(h.sequence(h.choice(h.ch('a'), h.ch('A')),
+                                  h.choice(h.ch('b'), h.ch('B')))) {|x|
+                x.unmarshal.join(",")}
+  end
+  def test_1
+    assert_parse_ok @parser, "ab", "a,b"
+  end
+  def test_2
+    assert_parse_ok @parser, "AB", "A,B"
+  end
+  def test_3
+    refute_parse_ok @parser, "XX"
+  end
+end
-- 
GitLab