Action works, too
This commit is contained in:
parent
3d791412f0
commit
cafa9adb1a
1 changed files with 18 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue