Author: particle
Date: Fri Nov 11 08:00:22 2005
New Revision: 9903

Modified:
   trunk/t/p6rules/backtrack.t
   trunk/t/p6rules/builtins.t
   trunk/t/p6rules/capture.t
   trunk/t/p6rules/cclass.t
   trunk/t/p6rules/closure.t
   trunk/t/p6rules/metachars.t
   trunk/t/p6rules/modifiers.t
   trunk/t/p6rules/subrules.t
   trunk/t/p6rules/text_brk.t
Log:
PGE test refactoring. also, modified copyright
info and added pod sections to each test file.

Modified: trunk/t/p6rules/backtrack.t
==============================================================================
--- trunk/t/p6rules/backtrack.t (original)
+++ trunk/t/p6rules/backtrack.t Fri Nov 11 08:00:22 2005
@@ -4,13 +4,26 @@
 
 use strict;
 use warnings;
+use lib qw( t . lib ../lib ../../lib ../../../lib );
 use Test::More;
 use Parrot::Test;
 use Parrot::Test::PGE;
 
 
-## tests based on http://dev.perl.org/perl6/doc/design/syn/S05.html, ver. 7
-##   in the 'Backtracking control' section
+=head1 NAME
+
+t/p6rules/backtrack.t - PGE backtracking tests
+
+=head1 DESCRIPTION
+
+These tests are based on L<http://dev.perl.org/perl6/doc/design/syn/S05.html>,
+ver. 7, in the B<Backtracking control> section
+
+=head1 SYNOPSIS
+
+       % prove t/p6rules/backtrack.t
+
+=cut
 
 
 ## : -- cut over preceding atom

Modified: trunk/t/p6rules/builtins.t
==============================================================================
--- trunk/t/p6rules/builtins.t  (original)
+++ trunk/t/p6rules/builtins.t  Fri Nov 11 08:00:22 2005
@@ -1,16 +1,30 @@
 #!perl
-# Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
+# Copyright: 2001-2005 The Perl Foundation.  All Rights Reserved.
 # $Id$
 
 use strict;
 use warnings;
+use lib qw( t . lib ../lib ../../lib ../../../lib );
 use Test::More;
 use Parrot::Test;
 use Parrot::Test::PGE;
 
 
-## tests based on http://dev.perl.org/perl6/doc/design/syn/S05.html, ver. 7
-##   in the 'Extensible metasyntax (<...>)' and 'Nothing is illegal' sections
+=head1 NAME
+
+t/p6rules/builtins.t - PGE tests of builtin rules
+
+=head1 DESCRIPTION
+
+These tests are based on L<http://dev.perl.org/perl6/doc/design/syn/S05.html>,
+ver. 7, in the B<<'Extensible metasyntax (<...>)'>> and
+B<'Nothing is illegal'> sections
+
+=head1 SYNOPSIS
+
+       % prove t/p6rules/builtins.t
+
+=cut
 
 
 my $str = 

Modified: trunk/t/p6rules/capture.t
==============================================================================
--- trunk/t/p6rules/capture.t   (original)
+++ trunk/t/p6rules/capture.t   Fri Nov 11 08:00:22 2005
@@ -1,14 +1,31 @@
 #!perl
-# Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
+# Copyright: 2001-2005 The Perl Foundation.  All Rights Reserved.
 # $Id$
 
 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/p6rules/capture.t - PGE capture tests
+
+=head1 DESCRIPTION
+
+These tests are based on L<http://dev.perl.org/perl6/doc/design/syn/S05.html>,
+ver. 7, in the B<'Bracket rationalization'> section
+
+=head1 SYNOPSIS
+
+       % prove t/p6rules/capture.t
+
+=cut
+
+
 p6rule_is  ('zzzabcdefzzz', '(a.)..(..)', 'basic match');
 p6rule_like('zzzabcdefzzz', '(a.)..(..)', qr/mob: <abcdef @ 3>/, 'basic $0');
 p6rule_like('zzzabcdefzzz', '(a.)..(..)', qr/mob 0: <ab @ 3>/, 'basic $1');

Modified: trunk/t/p6rules/cclass.t
==============================================================================
--- trunk/t/p6rules/cclass.t    (original)
+++ trunk/t/p6rules/cclass.t    Fri Nov 11 08:00:22 2005
@@ -1,14 +1,31 @@
 #!perl
-# Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
+# Copyright: 2001-2005 The Perl Foundation.  All Rights Reserved.
 # $Id$
 
 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/p6rules/cclass.t - PGE capture tests
+
+=head1 DESCRIPTION
+
+These tests are based on L<http://dev.perl.org/perl6/doc/design/syn/S05.html>,
+ver. 7, in the B<<'Extensible metasyntax (<...>)'>> section
+
+=head1 SYNOPSIS
+
+       % prove t/p6rules/cclass.t
+
+=cut
+
+
 # character class
 p6rule_is  ('abcdef', '<[c]>', 'character class');
 p6rule_is  ('abcdef', '<[dcb]>**{3}', 'repeated character class');

Modified: trunk/t/p6rules/closure.t
==============================================================================
--- trunk/t/p6rules/closure.t   (original)
+++ trunk/t/p6rules/closure.t   Fri Nov 11 08:00:22 2005
@@ -1,14 +1,31 @@
 #!perl
-# Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
+# Copyright: 2001-2005 The Perl Foundation.  All Rights Reserved.
 # $Id$
 
 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/p6rules/closure.t - PGE closure tests
+
+=head1 DESCRIPTION
+
+These tests are based on L<http://dev.perl.org/perl6/doc/design/syn/S05.html>,
+ver. 7, in the B<'Bracket rationalization'> section
+
+=head1 SYNOPSIS
+
+       % prove t/p6rules/closure.t
+
+=cut
+
+
 p6rule_like("abcd",  "<alpha>**{3} {{ print match }}",
     qr/abcmatched/, "PIR closure");
 

Modified: trunk/t/p6rules/metachars.t
==============================================================================
--- trunk/t/p6rules/metachars.t (original)
+++ trunk/t/p6rules/metachars.t Fri Nov 11 08:00:22 2005
@@ -1,18 +1,31 @@
 #!perl
-# Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
+# Copyright: 2001-2005 The Perl Foundation.  All Rights Reserved.
 # $Id$
 
 use strict;
 use warnings;
+use lib qw( t . lib ../lib ../../lib ../../../lib );
 use Test::More;
 use Parrot::Test;
 use Parrot::Test::PGE;
 use Parrot::Config;
 
 
-## tests based on http://dev.perl.org/perl6/doc/design/syn/S05.html, ver. 7
-##   in the 'Changed metacharacters' , 'New metacharacters', and
-##   'Backslash Reform' sections
+=head1 NAME
+
+t/p6rules/metachars.t - PGE metacharacter syntax tests
+
+=head1 DESCRIPTION
+
+These tests are based on L<http://dev.perl.org/perl6/doc/design/syn/S05.html>,
+ver. 7, in the B<'Changed metacharacters'>, B<'New metacharacters'>, and
+B<'Backslash Reform'> sections
+
+=head1 SYNOPSIS
+
+       % prove t/p6rules/metachars.t
+
+=cut
 
 
 ## . -- matches any char, including newline
@@ -287,5 +300,40 @@ p6rule_isnt("abc!!def", 'c \O41+ d', 'no
 p6rule_is  ("abcdef", 'a \O41+ f', 'not octal (\O)');
 
 
+## \b and \B -- word boundaries
+my $str = q{abc
+def
+-==
+ghi};
+
+p6rule_is  ($str, '\bdef', 'word boundary \W\w');
+p6rule_is  ($str, 'abc\b', 'word boundary \w\W');
+p6rule_is  ($str, '\babc', 'BOS word boundary');
+p6rule_is  ($str, 'ghi\b', 'EOS word boundary');
+p6rule_isnt($str, 'a\b',   '\w\w word boundary');
+p6rule_isnt($str, '-\b',   '\W\W word boundary');
+
+p6rule_isnt($str, '\Bdef', 'nonword boundary \W\w');
+p6rule_isnt($str, 'abc\B', 'nonword boundary \w\W');
+p6rule_isnt($str, '\Babc', 'BOS nonword boundary');
+p6rule_isnt($str, 'ghi\B', 'EOS nonword boundary');
+p6rule_is  ($str, 'a\B',   '\w\w nonword boundary');
+p6rule_is  ($str, '-\B',   '\W\W nonword boundary');
+
+
+## \w an \W -- word characters
+p6rule_isnt('a=[ *f', 'a\w+f', 'word character');
+p6rule_is  ("abcdef", 'a\w+f', 'word character');
+p6rule_is  ('a&%- f', 'a\W+f', 'not word character');
+p6rule_isnt("abcdef", 'a\W+f', 'not word character');
+
+
+## \d and \D -- digits
+p6rule_isnt('abcdef', 'a\d+f', 'digit');
+p6rule_is  ("ab42cdef", 'ab\d+cdef', 'digit');
+p6rule_is  ('abcdef', 'a\D+f', 'not digit');
+p6rule_isnt("ab0cdef", 'a\D+f', 'not digit');
+
+
 ## remember to change the number of tests :-)
-BEGIN { plan tests => 167; }
+BEGIN { plan tests => 187; }

Modified: trunk/t/p6rules/modifiers.t
==============================================================================
--- trunk/t/p6rules/modifiers.t (original)
+++ trunk/t/p6rules/modifiers.t Fri Nov 11 08:00:22 2005
@@ -1,16 +1,29 @@
 #!perl
-# Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
+# Copyright: 2001-2005 The Perl Foundation.  All Rights Reserved.
 # $Id$
 
 use strict;
 use warnings;
+use lib qw( t . lib ../lib ../../lib ../../../lib );
 use Test::More;
 use Parrot::Test;
 use Parrot::Test::PGE;
 
 
-## tests based on http://dev.perl.org/perl6/doc/design/syn/S05.html, ver. 7
-##   in the 'Modifiers' section
+=head1 NAME
+
+t/p6rules/modifiers.t - PGE rule modifier tests
+
+=head1 DESCRIPTION
+
+These tests are based on L<http://dev.perl.org/perl6/doc/design/syn/S05.html>,
+ver. 7, in the B<'Modifiers'> section
+
+=head1 SYNOPSIS
+
+       % prove t/p6rules/modifiers.t
+
+=cut
 
 
 ## setup template for pir tests
@@ -99,7 +112,6 @@ p6rule_is  ('ABCDEF', ':1ignorecase ab [
 
 
 ## :w and :words -- magically ignore whitespace
-## TODO lexical scoping of :w
 p6rule_is  ('a bcdef', ':w bcd', 'words (:w)');
 p6rule_is  ('a bcd ef', ':w bcd', 'words (:w)');
 p6rule_isnt('abcdef', ':w bcd', 'words (:w)');
@@ -121,6 +133,39 @@ p6rule_is  ('a b c def', ':w(1) b c [:w(
 p6rule_isnt('a b c def', ':w(0) b c [:w(1) d e f ]', 'words, lexical 
repetition (:w)');
 p6rule_isnt('a b c def', ':w(0) b c [:w(0) d e f ]', 'words, lexical 
repetition (:w)');
 
+## without :w
+p6rule_is  ("foo\t \n-\n\t bar", 'foo\s*-?\s*bar', 'basic match');
+p6rule_is  ('foo - bar', 'foo\s*-?\s*bar', 'basic match');
+p6rule_is  ('foo   bar', 'foo\s+-?\s*bar', 'basic match \s+ \s*');
+p6rule_is  ('foo  -bar', 'foo\s+-?\s*bar', 'basic match \s+ \s*');
+p6rule_is  ('foo-  bar', 'foo\s*-?\s+bar', 'basic match \s* \s+');
+p6rule_is  ('foo-bar', 'foo -? bar', 'basic match \s* \s*');
+p6rule_is  ('foobar', 'foo -? bar', 'basic match');
+p6rule_isnt('foo - bar', 'foo -? bar', 'basic non-match');
+
+## with :w
+p6rule_is  ("foo\n \t- \t\t\nbar", ':w foo -? bar', 'basic ws match');
+p6rule_is  ('foo - bar', ':w foo -? bar', 'basic ws match');
+p6rule_is  ('foo   bar', ':w foo -? bar', 'basic ws match \s+ \s*');
+p6rule_is  ('foo  -bar', ':w foo -? bar', 'basic ws match \s+ \s*');
+p6rule_is  ('foo-  bar', ':w foo -? bar', 'basic ws match \s* \s+');
+p6rule_is  ('foo-bar', ':w foo -? bar', 'basic ws match \s* \s*');
+p6rule_isnt('foobar', ':w foo -? bar', 'basic ws non-match');
+
+## with :w not separated by a space
+p6rule_isnt('foo - bar', ':w()foo -? bar', 'basic ws match');
+p6rule_is  ('foo - bar', ':w[]foo -? bar', 'basic ws match',
+    todo => 'words modifier [] separation not implemented');
+p6rule_is  ('foo - bar', ':w\bfoo -? bar',
+    'basic ws match with boundary modifier separation');
+p6rule_is  ('foo - bar', ':w::foo -? bar',
+    'basic ws match with backtrack no-op modifier separation');
+
+p6rule_like('dog := spot', ':w::(\w+) \:= (\S+)', qr/mob 0: <dog @ 0>/,
+    'words and capture together');
+p6rule_like('dog := spot', ':w::(\w+) \:= (\S+)', qr/mob 1: <spot @ 7>/,
+    'words and capture together');
+
 
 ## :once -- match only once
 # N.B.: the :once modifier does not really belong to PGE or
@@ -147,6 +192,7 @@ p6rule_is  ('123456', ':x(0) \d', 'repet
 ## :nth -- nth occurance
 p6rule_is  ('a1a2a3', ':nth(3) a \d', 'nth occurance (:nth)');
 p6rule_isnt('a1a2a3', ':nth(4) a \d', 'nth occurance (:nth)', todo => 'not yet 
implemented');
+p6rule_isnt('a1a2a3', ':nth(0) a \d', 'nth occurance (:nth)', todo => 'not yet 
implemented');
 ## TODO more tests here
 
 
@@ -155,4 +201,4 @@ p6rule_isnt('a1a2a3', ':nth(4) a \d', 'n
 
 
 ## remember to change the number of tests :-)
-BEGIN { plan tests => 75; }
+BEGIN { plan tests => 97; }

Modified: trunk/t/p6rules/subrules.t
==============================================================================
--- trunk/t/p6rules/subrules.t  (original)
+++ trunk/t/p6rules/subrules.t  Fri Nov 11 08:00:22 2005
@@ -1,14 +1,31 @@
 #!perl
-# Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
+# Copyright: 2001-2005 The Perl Foundation.  All Rights Reserved.
 # $Id$
 
 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/p6rules/subrules.t - PGE subrules tests
+
+=head1 DESCRIPTION
+
+These tests are based on L<http://dev.perl.org/perl6/doc/design/syn/S05.html>,
+ver. 7, in the B<'Named regexes'> section
+
+=head1 SYNOPSIS
+
+       % prove t/p6rules/subrules.t
+
+=cut
+
+
 p6rule_is  ("   int argc ",
     [
         [ type    => 'int | double | float | char' ],

Modified: trunk/t/p6rules/text_brk.t
==============================================================================
--- trunk/t/p6rules/text_brk.t  (original)
+++ trunk/t/p6rules/text_brk.t  Fri Nov 11 08:00:22 2005
@@ -1,14 +1,30 @@
 #!perl
-# Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
+# Copyright: 2001-2005 The Perl Foundation.  All Rights Reserved.
 # $Id$
 
 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/p6rules/text_brk.t - PGE::Text::bracketed tests
+
+=head1 DESCRIPTION
+
+These tests examine the ability of PGE to match text with brackets in it.
+
+=head1 SYNOPSIS
+
+       % prove t/p6rules/text_brk.t
+
+=cut
+
+
 ## First, test direct calls to PGE::Text::bracketed
 ##
 pir_output_is(<<'CODE', <<'OUT', "bracketed");

Reply via email to