[Bps-public-commit] r10214 - in RT-Client-Console: trunk trunk/t
dams at bestpractical.com
dams at bestpractical.com
Sun Dec 30 19:27:27 EST 2007
Author: dams
Date: Sun Dec 30 19:27:27 2007
New Revision: 10214
Added:
RT-Client-Console/trunk/t/programs.t
Modified:
RT-Client-Console/ (props changed)
RT-Client-Console/trunk/MANIFEST
Log:
r63 at pundit: dams | 2007-12-31 00:27:31 +0000
added test. From Maddingue.
Modified: RT-Client-Console/trunk/MANIFEST
==============================================================================
--- RT-Client-Console/trunk/MANIFEST (original)
+++ RT-Client-Console/trunk/MANIFEST Sun Dec 30 19:27:27 2007
@@ -16,3 +16,4 @@
MANIFEST This list of files
README
t/00-load.t
+t/programs.t
Added: RT-Client-Console/trunk/t/programs.t
==============================================================================
--- (empty file)
+++ RT-Client-Console/trunk/t/programs.t Sun Dec 30 19:27:27 2007
@@ -0,0 +1,38 @@
+#!perl -w
+use strict;
+use File::Spec::Functions;
+use Test::More;
+
+
+plan skip_all => "Test::Cmd not available" unless eval "use Test::Cmd; 1";
+plan skip_all => "Test::Program not available" unless eval "use Test::Program; 1";
+
+my %programs = (
+ rtconsole => "rtconsole",
+);
+
+plan tests => 6 * keys %programs;
+
+for my $command (keys %programs) {
+ my $program = $programs{$command};
+ my $cmdpath = catfile(curdir(), "blib", "script", $command);
+
+ # basic checks
+ #program_compiles_ok($cmdpath); #TODO: fails because of the warnings
+ program_pod_ok($cmdpath);
+
+ # more extensive checks
+ my $cmd = Test::Cmd->new(prog => $cmdpath, workdir => '');
+ ok( $cmd, "created Test::Cmd object for $command" );
+
+ # checking option --version
+ $cmd->run(args => '--version', 'chdir' => $cmd->curdir);
+ is( $?, 0, "exec: $command --version" );
+ like( $cmd->stdout, qr/^$program v\d+(\.\d+)+$/mi, " => checking version output" );
+
+ # checking usage
+ my $fakeopt = "this-is-not-an-option";
+ $cmd->run(args => "--$fakeopt", 'chdir' => $cmd->curdir);
+ isnt( $?, 0, "exec: $command --$fakeopt" );
+ like( $cmd->stderr, qr/^Unknown option: $fakeopt$/m, " => checking error" );
+}
More information about the Bps-public-commit
mailing list