citrus_test makes it easier to test Citrus grammars.

Quick Start

require 'citrus_test'

# citrus_test expects all your Citrus grammars to be located in grammar_dir.
# The path grammar_dir is set to is relative to the directory that the source
# file that set it is in. (If you're using irb, use an absolute path.)
GrammarTest.grammar_dir = "../grammars/"

# What you name your class is important. For example, this class will use the
# grammar located at ../grammars/nahuatal_language.citrus. The name of your
# class *must* end in Test.
class NahuatalLanguageTest < GrammarTest
    def test_possession
        # The parse() method returns the .value of the result of parsing.
        possessed_house = parse(:possession, "no-kal")
        assert_equal('house', possessed_house)

        # This asserts that:
        # _ = parse(:possession, "no-kal")
        # _ # => "house"
        # _.possessor # => "me"
        assert_parses(:possession, "no-kal", "house", possessor: "me")

        # deny_parses() does the opposite.
        deny_parses(:possession, "kal-li")