Changes:

-Added the same set of tests for :w to be performed without :w

-Added a couple of tests for both that include tabs, spaces and newlines

-Added C<use strict; use warnings;> to the test script. Is this a good
idea? I had gotten feedback from Coke and pjcj on #parrot about warnings
requiring a late-model Perl5.

-Added a comment reminder about adding tests using the ':words' form of
the modifier when it's available.


-------------------------------------------------------------------------
Index: t/p6rules/ws.t
===================================================================
--- t/p6rules/ws.t      (revision 8100)
+++ t/p6rules/ws.t      (working copy)
@@ -1,6 +1,21 @@
-use Parrot::Test tests => 6;
+use strict;
+use warnings;
+use Parrot::Test tests => 15;
 use Parrot::Test::PGE;

+
+# 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*');
@@ -8,4 +23,6 @@
 p6rule_is  ('foo-bar', ':w foo -? bar', 'basic ws match \s* \s*');
 p6rule_isnt('foobar', ':w foo -? bar', 'basic ws non-match');

+# XXX: When available, add tests for full form :words modifier
+
 # dont forget to change the number of tests :-)
-------------------------------------------------------------------------

-Dino

-- 
 .~.    Dino Morelli
 /V\    email: [EMAIL PROTECTED]
/( )\   weblog: http://categorically.net/d/blog/
^^-^^   preferred distro: Debian GNU/Linux  http://www.debian.org

Reply via email to