[Bps-public-commit] r16835 - sd/trunk/lib/App/SD

jesse at bestpractical.com jesse at bestpractical.com
Fri Nov 14 14:47:13 EST 2008


Author: jesse
Date: Fri Nov 14 14:47:12 2008
New Revision: 16835

Modified:
   sd/trunk/lib/App/SD/Test.pm

Log:
* Deal with 5.10 being more finnicky about my variables inside regexps evaluated in subs


Modified: sd/trunk/lib/App/SD/Test.pm
==============================================================================
--- sd/trunk/lib/App/SD/Test.pm	(original)
+++ sd/trunk/lib/App/SD/Test.pm	Fri Nov 14 14:47:12 2008
@@ -13,6 +13,8 @@
 delete $ENV{'PROPHET_APP_CONFIG'};
 $ENV{'EDITOR'} = '/bin/true';
 
+our ($A, $B, $C, $D);
+
 =head2 create_ticket_ok ARGS
 
 Creates a new ticket, passing ARGS along to the creation command (after the
@@ -24,12 +26,12 @@
 
 sub create_ticket_ok {
     my @args = (@_);
-    my ( $uuid, $luid );
     local $Test::Builder::Level = $Test::Builder::Level + 1;
     Prophet::Test::run_output_matches( 'sd', [ 'ticket', 'create', '--', @args ],
-        [qr/Created ticket (.*?)(?{ $luid = $1})\s+\((.*)(?{ $uuid = $2 })\)/]
+        [qr/Created ticket (.*?)(?{ $A = $1})\s+\((.*)(?{ $B = $2 })\)/]
     );
 
+    my ( $uuid, $luid ) =($B,$A);
     return ( $luid, $uuid );
 }
 
@@ -43,13 +45,13 @@
 
 sub create_ticket_comment_ok {
     my @args = (@_);
-    my ( $uuid, $luid );
     local $Test::Builder::Level = $Test::Builder::Level + 1;
     Prophet::Test::run_output_matches(
         'sd',
         [ 'ticket', 'comment', 'create', @args ],
-        [qr/Created comment (.*?)(?{ $luid = $1})\s+\((.*)(?{ $uuid = $2 })\)/]
+        [qr/Created comment (.*?)(?{ $A = $1})\s+\((.*)(?{ $B = $2 })\)/]
     );
+    my ( $uuid, $luid ) = ($B, $A);
 
     return ( $luid, $uuid );
 }
@@ -98,14 +100,15 @@
 
 =cut
 
+
 sub create_ticket_with_editor_ok {
-    my ( $ticket_uuid, $ticket_luid, $comment_uuid, $comment_luid );
     local $Test::Builder::Level = $Test::Builder::Level + 1;
     Prophet::Test::run_output_matches( 'sd', [ 'ticket', 'create' ],
-        [qr/Created ticket (.*?)(?{ $ticket_luid = $1})\s+\((.*)(?{ $ticket_uuid = $2 })\)/,
-        qr/Created comment (.*?)(?{ $comment_luid = $1})\s+\((.*)(?{ $comment_uuid = $2 })\)/]
+        [qr/Created ticket (.*?)(?{ $A = $1})\s+\((.*)(?{ $B = $2 })\)/,
+        qr/Created comment (.*?)(?{ $C = $1})\s+\((.*)(?{ $D = $2 })\)/]
     );
 
+    my ( $ticket_uuid, $ticket_luid, $comment_uuid, $comment_luid )=  ($B,$A,$D,$C);
     return ( $ticket_luid, $ticket_uuid, $comment_luid, $comment_uuid );
 }
 
@@ -124,14 +127,14 @@
     my $self = shift;
     my $ticket_luid = shift;
     my $ticket_uuid = shift;
-    my ($comment_luid, $comment_uuid);
 
     local $Test::Builder::Level = $Test::Builder::Level + 1;
     Prophet::Test::run_output_matches( 'sd', [ 'ticket', 'update', $ticket_uuid ],
-        [ qr/Updated ticket (.*?)(?{ $ticket_luid })\s+\((.*)(?{ $ticket_uuid })\)/,
-          qr/Created comment (.*?)(?{ $comment_luid = $1 })\s+\((.*)(?{ $comment_uuid = $2 })\)/ ]
+        [ qr/Updated ticket (.*?)\s+\((.*)\)/,
+          qr/Created comment (.*?)(?{ $A = $1 })\s+\((.*)(?{ $B = $2 })\)/ ]
     );
 
+    my ($comment_luid, $comment_uuid) = ($A, $B);
     return ( $comment_luid, $comment_uuid );
 }
 
@@ -150,7 +153,7 @@
     local $Test::Builder::Level = $Test::Builder::Level + 1;
     Prophet::Test::run_output_matches( 'sd',
         [ 'ticket', 'comment', 'update', $comment_uuid ],
-        [ qr/Updated comment (.*?)(?{ $comment_luid })\s+\((.*)(?{ $comment_uuid })\)/]
+        [ 'Updated comment '.$comment_luid . ' ('. $comment_uuid .')']
     );
 }
 



More information about the Bps-public-commit mailing list