[Bps-public-commit] r13406 - in Shipwright/trunk: .
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Wed Jun 18 17:12:25 EDT 2008
Author: sunnavy
Date: Wed Jun 18 17:12:25 2008
New Revision: 13406
Modified:
Shipwright/trunk/ (props changed)
Shipwright/trunk/lib/Shipwright/Test.pm
Log:
r13541 at sunnavys-mb: sunnavy | 2008-06-19 03:54:43 +0800
added err msg check
Modified: Shipwright/trunk/lib/Shipwright/Test.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Test.pm (original)
+++ Shipwright/trunk/lib/Shipwright/Test.pm Wed Jun 18 17:12:25 2008
@@ -115,20 +115,34 @@
=cut
sub test_cmd {
- my $repo = shift;
- my $cmd = shift;
- my $exp = shift;
- my $msg = shift;
+ my $repo = shift;
+ my $cmd = shift;
+ my $exp = shift;
+ my $msg = shift;
+ my $exp_err = shift;
+ my $msg_err = 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 );
+ my ( $out, $err ) = Shipwright::Util->run( $cmd, 1 ); # ingnore failure
+
+ if ( defined $exp ) {
+ if ( ref $exp eq 'Regexp' ) {
+ Test::More::like( $out, $exp, $msg );
+ }
+ else {
+ Test::More::is( $out, $exp, $msg );
+ }
}
- else {
- Test::More::is( $out, $exp, $msg );
+
+ if ( defined $exp_err ) {
+ if ( ref $exp_err eq 'Regexp' ) {
+ Test::More::like( $err, $exp_err, $msg_err );
+ }
+ else {
+ Test::More::is( $err, $exp_err, $msg_err );
+ }
}
}
More information about the Bps-public-commit
mailing list