Skip to content
Snippets Groups Projects
Commit cafa9adb authored by Dan Hirsch's avatar Dan Hirsch
Browse files

Action works, too

parent 3d791412
No related branches found
No related tags found
No related merge requests found
...@@ -112,3 +112,21 @@ class AttrBoolTest < Minitest::Test ...@@ -112,3 +112,21 @@ class AttrBoolTest < Minitest::Test
refute_parse_ok @parser, "ab" refute_parse_ok @parser, "ab"
end end
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment