Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ometa/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,7 @@ def digit(self):
rule_end = end
rule_ws = eatWhitespace
rule_exactly = exactly
rule_apply = apply

#Deprecated.
rule_spaces = eatWhitespace
Expand Down
11 changes: 11 additions & 0 deletions ometa/test/test_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ def test_exactlyFail(self):
self.assertEquals(exc.args[0], 0)


def test_apply(self):
"""
L{OMetaBase.rule_apply} applies the given rule with arguments.
"""
data = "foo"
o = OMetaBase(data)
v, e = o.rule_apply("exactly", "f")
self.assertEqual(v, "f")
self.assertEqual(e.args[0], 0)
self.assertRaises(NameError, o.rule_apply, "foo")


def test_token(self):
"""
Expand Down