# New Ticket Created by  Dino Morelli 
# Please include the string:  [perl #36247]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=36247 >


I added support to Parrot::Test::PGE for chromatic's new todo feature of
the unit testing code.

files:

lib/Parrot/Test/PGE.pm
    All three functions support the optional todo. p6rule_is(),
p6rule_isnt(), p6rule_like()

lib/Parrot/Test.pm
    SEE BELOW

t/p6rules/ws.t
    Uncommented existing future tests and added todo args to them.


*** to chromatic: ***
I had to make a change to Parrot::Test

Index: lib/Parrot/Test.pm
===================================================================
--- lib/Parrot/Test.pm  (revision 8301)
+++ lib/Parrot/Test.pm  (working copy)
@@ -430,7 +430,7 @@
             }

             # set a TODO for Test::Builder to find
-            my $call_pkg = $builder->exported_to();
+            my $call_pkg = $builder->exported_to() || '';
             local *{ $call_pkg . '::TODO' } = \$extra{todo}
                 if defined $extra{todo};
===================================================================

Without this change, this comes out of Parrot::Test when invoked from
Parrot::Test::PGE with todo args:

"Use of uninitialized value in concatenation (.) or string at
lib/Parrot/Test.pm line 434."

I looked at it for a while but am somewhat confused about why this
exported_to() is returning undef. I'm not sure this || '' was the way to
fix it and am asking you to weigh in on it.


Thanks for implementing the todo and thanks for taking a look at this
issue.


-Dino

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

===================================================================

--- lib/Parrot/Test/PGE.pm      (revision 8304)

+++ lib/Parrot/Test/PGE.pm      (working copy)

@@ -61,17 +61,20 @@

 =cut

 

 sub p6rule_is {

-    my ($target, $pattern, $description) = @_;

+    my ($target, $pattern, $description, @todo) = @_;

+

     if (ref $pattern) {

         Parrot::Test::pir_output_is(

             Parrot::Test::PGE::_generate_subrule_pir($target, $pattern),

             'matched',

-            $description);

+            $description,

+            @todo);

     } else {

         Parrot::Test::pir_output_is(

             Parrot::Test::PGE::_generate_pir_for($target, $pattern),

             'matched',

-            $description);

+            $description,

+            @todo);

     }

 }

 

@@ -83,17 +86,20 @@

 =cut

 

 sub p6rule_isnt {

-    my ($target, $pattern, $description) = @_;

+    my ($target, $pattern, $description, @todo) = @_;

+

     if (ref $pattern) {

         Parrot::Test::pir_output_is(

             Parrot::Test::PGE::_generate_subrule_pir($target, $pattern),

             'failed',

-            $description);

+            $description,

+            @todo);

     } else {

         Parrot::Test::pir_output_is(

             Parrot::Test::PGE::_generate_pir_for($target, $pattern),

             'failed',

-            $description);

+            $description,

+            @todo);

     }

 }

 

@@ -106,11 +112,12 @@

 =cut

 

 sub p6rule_like {

-    my ($target, $pattern, $expected, $description) = @_;

+    my ($target, $pattern, $expected, $description, @todo) = @_;

     Parrot::Test::pir_output_like(

             Parrot::Test::PGE::_generate_pir_for($target, $pattern, 1),

             $expected,

-            $description);

+            $description,

+            @todo);

 }

 

 package Parrot::Test::PGE;

Index: lib/Parrot/Test.pm

===================================================================

--- lib/Parrot/Test.pm  (revision 8304)

+++ lib/Parrot/Test.pm  (working copy)

@@ -430,7 +430,7 @@

             }

 

             # set a TODO for Test::Builder to find

-            my $call_pkg = $builder->exported_to();

+            my $call_pkg = $builder->exported_to() || '';

             local *{ $call_pkg . '::TODO' } = \$extra{todo}

                 if defined $extra{todo};

 

Index: t/p6rules/ws.t

===================================================================

--- t/p6rules/ws.t      (revision 8304)

+++ t/p6rules/ws.t      (working copy)

@@ -1,6 +1,6 @@

 use strict;

 use warnings;

-use Parrot::Test tests => 19;

+use Parrot::Test tests => 21;

 use Parrot::Test::PGE;

 

 

@@ -24,9 +24,10 @@

 p6rule_isnt('foobar', ':w foo -? bar', 'basic ws non-match');

 

 # with :w not separated by a space

-# XXX: These forms of modifier separation do not yet work

-#p6rule_is  ('foo - bar', ':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',

+    todo => 'words modifier () separation not implemented');

+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',

Reply via email to