README

Test::Grammar for Raku

Unit testing for grammars. Because testing is important.

Installing

No dependencies, except Test which is a Rakudo core library, so the usual zef install Test::Grammar.

Running

Copied from the source, version there is the single source of truth:

use Test::Grammar;

parses-ok Test-Grammar,"num", 3, "33 parses OK";

my $test-output = q:to/EOC/;
ok 1 - bailout parses OK
ok 2 - Ā«bailoutĀ» extracts token
1..2
EOC

has-tokens Test-Grammar, "test", <nok num description>, $test-output,
    "Complete tests";

token-is Test-Grammar,"bailout", "explanation",
    "Bail out! FOOBAR",
    "FOOBAR",
    "Ā«bailoutĀ» extracts token";

for <foo bar b3> {
    parses-nok Test-Grammar,"num", $_, "$_ not parsed";
}

See also

There are very nice testing libraries out there:

  • T emphasizes output and messages

  • Testo is another opinionated test library.

License

(c) JJ Merelo, [email protected], 2022

Licensed under the Artistic 2.0 License (the same as Raku itself).

Test::Grammar v0.0.1

Raku distribution template

Authors

  • JJ Merelo

License

Artistic-2.0

Dependencies

Test Dependencies

Provides

  • Test::Grammar

Documentation

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.