[Bps-public-commit] r13402 - in Shipwright/trunk: .

sunnavy at bestpractical.com sunnavy at bestpractical.com
Wed Jun 18 17:11:34 EDT 2008


Author: sunnavy
Date: Wed Jun 18 17:11:34 2008
New Revision: 13402

Modified:
   Shipwright/trunk/   (props changed)
   Shipwright/trunk/lib/Shipwright/Test.pm

Log:
 r13537 at sunnavys-mb:  sunnavy | 2008-06-19 02:44:41 +0800
 added test_cmd for test


Modified: Shipwright/trunk/lib/Shipwright/Test.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Test.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Test.pm	Wed Jun 18 17:11:34 2008
@@ -9,7 +9,8 @@
 use File::Spec;
 
 our @EXPORT =
-  qw/has_svk has_svn create_svk_repo create_svn_repo devel_cover_enabled/;
+  qw/has_svk has_svn create_svk_repo create_svn_repo devel_cover_enabled
+  test_cmd/;
 
 =head1 NAME
 
@@ -107,6 +108,30 @@
     return $INC{'Devel/Cover.pm'};
 }
 
+=head2 test_cmd
+
+a simple wrap for test cmd like create, list ...
+
+=cut
+
+sub test_cmd {
+    my $repo   = shift;
+    my $cmd    = shift;
+    my $exp = shift;
+    my $msg    = shift;
+
+    unshift @$cmd, $^X, '-MDevel::Cover' if devel_cover_enabled;
+
+    require Test::More;
+    my $out = Shipwright::Util->run($cmd, 1); # ingnore failure
+    if ( ref $exp eq 'Regexp' ) {
+        Test::More::like( $out, $exp, $msg );
+    }
+    else {
+        Test::More::is( $out, $exp, $msg );
+    }
+}
+
 1;
 
 __END__



More information about the Bps-public-commit mailing list