Added tests to t/p6rules/ws.t

0 views
Skip to first unread message

Dino Morelli

unread,
May 14, 2005, 11:36:30 AM5/14/05
to Perl 6 Internals list
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: dmor...@reactorweb.net
/( )\ weblog: http://categorically.net/d/blog/
^^-^^ preferred distro: Debian GNU/Linux http://www.debian.org

Patrick R. Michaud

unread,
May 14, 2005, 12:41:47 PM5/14/05
to Dino Morelli, Perl 6 Internals list
On Sat, May 14, 2005 at 11:36:30AM -0400, Dino Morelli wrote:
> 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.

Patch applied (r8101), thanks!

Pm

Reply all
Reply to author
Forward
0 new messages