[Bps-public-commit] r13329 - in Shipwright/trunk: t

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon Jun 16 14:31:57 EDT 2008


Author: sunnavy
Date: Mon Jun 16 14:31:56 2008
New Revision: 13329

Added:
   Shipwright/trunk/t/04.source.t
Modified:
   Shipwright/trunk/   (props changed)

Log:
 r13451 at sunnavys-mb:  sunnavy | 2008-06-17 02:15:38 +0800
 added 04.source.t


Added: Shipwright/trunk/t/04.source.t
==============================================================================
--- (empty file)
+++ Shipwright/trunk/t/04.source.t	Mon Jun 16 14:31:56 2008
@@ -0,0 +1,37 @@
+use strict;
+use warnings;
+
+use Test::More tests => 12;
+use Shipwright::Test;
+use Shipwright::Source;
+
+Shipwright::Test->init;
+
+my %source = (
+    'http://example.com/hello.tar.gz'           => 'HTTP',
+    'ftp://example.com/hello.tar.gz'            => 'FTP',
+    'svn:file:///home/sunnavy/svn/hello'        => 'SVN',
+    'svk://local/hello'                         => 'SVK',
+    'cpan:Acme::Hello'                          => 'CPAN',
+    'cpan:S/SU/SUNNAVY/IP-QQWry-v0.0.15.tar.gz' => 'CPAN',
+    'file:'
+      . File::Spec->catfile( 't', 'hello', 'Acme-Hello-0.03.tar.gz' ) =>
+      'Compressed',
+    'dir:' . File::Spec->catfile( 't', 'hello' ) => 'Directory',
+);
+
+for ( keys %source ) {
+    my $source = Shipwright::Source->new( source => $_ );
+    isa_ok( $source, 'Shipwright::Source::' . $source{$_}, $_ );
+}
+
+my @invalid_sources = ( 'file:/tmp/ok', 'foo', '' );
+
+for (@invalid_sources) {
+    eval { my $source = Shipwright::Source->new( source => $_ ) };
+    like( $@, qr/invalid source/, "$_ is invalid source" );
+}
+
+eval { my $source = Shipwright::Source->new };
+like( $@, qr/need source arg/, 'new need source arg' );
+



More information about the Bps-public-commit mailing list