[Bps-public-commit] r13410 - in Shipwright/trunk: t
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Wed Jun 18 17:13:19 EDT 2008
Author: sunnavy
Date: Wed Jun 18 17:13:19 2008
New Revision: 13410
Modified:
Shipwright/trunk/ (props changed)
Shipwright/trunk/t/71.script_cmds.t
Log:
r13545 at sunnavys-mb: sunnavy | 2008-06-19 05:07:42 +0800
more cmd tests
Modified: Shipwright/trunk/t/71.script_cmds.t
==============================================================================
--- Shipwright/trunk/t/71.script_cmds.t (original)
+++ Shipwright/trunk/t/71.script_cmds.t Wed Jun 18 17:13:19 2008
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use Test::More tests => 8;
+use Test::More tests => 20;
use Shipwright;
use Shipwright::Test;
@@ -11,7 +11,7 @@
Shipwright::Test->init;
SKIP: {
- skip "no svn found", 4
+ skip "no svn found", 10
unless has_svn();
my $repo = 'svn:' . create_svn_repo() . '/hello';
@@ -20,7 +20,7 @@
}
SKIP: {
- skip "no svk and svnadmin found", 4
+ skip "no svk and svnadmin found", 10
unless has_svk();
create_svk_repo();
@@ -32,12 +32,24 @@
sub start_test {
my $repo = shift;
+
+ # test create
test_cmd(
$repo,
[ $sw, 'create', '-r', $repo ],
qr/created with success/,
"create $repo"
);
+
+ # test non exist cmd
+ test_cmd(
+ $repo, [ $sw, 'obra', '-r', $repo ],
+ undef, undef,
+ qr/Command not recognized/,
+ "non exist cmd",
+ );
+
+ # test list
test_cmd( $repo, [ $sw, 'list', '-r', $repo ], '', "list null $repo" );
test_cmd(
$repo,
@@ -45,6 +57,53 @@
qr/foo doesn't exist/,
"list non exist name $repo"
);
- test_cmd( $repo, [ $sw, 'import', '-r', $repo ], '', "list null $repo" );
+
+ # test import
+ test_cmd(
+ $repo, [ $sw, 'import', '-r', $repo ],
+ undef, undef,
+ qr/need source arg/,
+ 'import without --source ...'
+ );
+
+ test_cmd(
+ $repo, [ $sw, 'import', '-r', $repo, '--source' ],
+ undef, undef,
+ qr/source requires an argument/,
+ 'import with --source but no value'
+ );
+
+ test_cmd(
+ $repo, [ $sw, 'import', '-r', $repo, '--source', 'foo' ],
+ undef, undef,
+ qr/invalid source: foo/,
+ 'import with invalid source'
+ );
+
+ test_cmd(
+ $repo, [ $sw, 'import', '-r', $repo, 'foo' ],
+ undef, undef,
+ qr/invalid source: foo/,
+ 'import with invalid source'
+ );
+
+ test_cmd(
+ $repo,
+ [
+ $sw, 'import', '-r', $repo, 'file:t/hello/Acme-Hello-0.03.tar.gz',
+ '--follow', 0
+ ],
+ qr/imported with success/,
+ 'import tar.gz file',
+ );
+
+ test_cmd(
+ $repo,
+ [ $sw, 'list', '-r', $repo, ],
+ qr{Acme-Hello:\s+
+ version:\s+0\.03\s+
+ from:\s+\Qfile:t/hello/Acme-Hello-0.03.tar.gz\E}mx,
+ 'list the repo',
+ );
}
More information about the Bps-public-commit
mailing list