#!perl # Copyright (C) 2001-2005, The Perl Foundation. # $Id: /local/t/compilers/pge/p6regex/subrules.t 13402 2006-07-20T18:04:44.539601Z pmichaud $ use strict; use warnings; use lib qw( t . lib ../lib ../../lib ../../../lib ); use Test::More; use Parrot::Test; use Parrot::Test::PGE; =head1 NAME t/p6regex/subrules.t - PGE subrules tests =head1 DESCRIPTION These tests are based on L, ver. 7, in the B<'Named regexes'> section =head1 SYNOPSIS % prove t/p6regex/subrules.t =cut p6rule_is (" int argc ", [ [ type => 'int | double | float | char' ], [ ident => '\w+' ], [ _MASTER => ':w ' ], ], "simple subrules"); p6rule_isnt("doggy", [ [ type => 'int | double | float | char' ], [ ident => '\w+' ], [ _MASTER => ':w ' ], ], "simple subrules"); p6rule_is ("(565) 325-2935", [ [ digits => '\d+' ], [ exch => '\(\)' ], [ _MASTER => ':w -' ], ], "nested subrules"); p6rule_isnt("0-900-04-41-59", [ [ digits => '\d+' ], [ exch => '\(\)' ], [ _MASTER => ':w -' ], ], "nested subrules"); p6rule_is("ab", [ [ alpha => '<[aeiou]>' ], [ _MASTER => '^ ' ], ], "named and lexical subrules"); #p6rule_isnt("ba", # [ # [ alpha => '<[aeiou]>' ], # [ _MASTER => '^ ' ], # ], # "named and lexical subrules"); p6rule_isnt(" ab", '^ : \ ab', "cut on subrules"); p6rule_isnt('whence', [ [ subrule => 'when ever' ], [ _MASTER => ' | whence' ], ], " in nested subrule"); # remember to change the number of tests :-) BEGIN { plan tests => 7; }