NAME

Parrot::Test::PGE - test functions for Perl 6 Grammar Engine

SYNOPSIS

In a .t file:

use Parrot::Test tests => 2;
use Parrot::Test::PGE;

p6rule_is('abc', '^abc', 'BOS abc');
p6rule_isnt('abc', '^bc', 'BOS bc');
p6rule_like('abcdef', 'bcd', qr/0: <bcd @ 1>/, '$0 capture');

DESCRIPTION

Parrot::Test::PGE provides functions for testing the grammar engine and Perl 6 rules.

Functions

p6rule_is($target, $pattern, $description)

Runs the target string against the Perl 6 pattern, passing the test if they match. Note that the pattern should be specified as a string and without leading/trailing pattern delimiters. (Hint: if you try using qr// for the $pattern then you're misreading what this does.)

p6rule_isnt($target, $pattern, $description)

Runs the target string against the Perl 6 pattern, passing the test if they do not match.

p6rule_like($target, $pattern, $expected, $description)

Runs the target string against the Perl 6 pattern, passing the test if the output produced by the test code matches the $expected parameter. Note that $expected is a Perl 5 pattern.

AUTHOR

Patrick R. Michaud, pmichaud@pobox.com 18-Nov-2004