[Bps-public-commit] r10381 - in bpsbuilder/BPB/t/hello: scripts

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu Jan 17 05:39:04 EST 2008


Author: sunnavy
Date: Thu Jan 17 05:39:04 2008
New Revision: 10381

Added:
   bpsbuilder/BPB/t/hello/
   bpsbuilder/BPB/t/hello/Acme-Hello-0.03.tar.gz   (contents, props changed)
   bpsbuilder/BPB/t/hello/backend.t
   bpsbuilder/BPB/t/hello/config.t
   bpsbuilder/BPB/t/hello/config.yml
   bpsbuilder/BPB/t/hello/hello.t
   bpsbuilder/BPB/t/hello/scripts/
   bpsbuilder/BPB/t/hello/scripts/build
   bpsbuilder/BPB/t/hello/scripts/require.yml
   bpsbuilder/BPB/t/hello/source.t

Log:
added hello tests

Added: bpsbuilder/BPB/t/hello/Acme-Hello-0.03.tar.gz
==============================================================================
Binary file. No diff available.

Added: bpsbuilder/BPB/t/hello/backend.t
==============================================================================
--- (empty file)
+++ bpsbuilder/BPB/t/hello/backend.t	Thu Jan 17 05:39:04 2008
@@ -0,0 +1,37 @@
+use strict;
+use warnings;
+
+use Test::More tests => 4;
+
+use BPB;
+use File::Temp qw/tempdir/;
+use File::Copy;
+
+my $bpb = BPB->new(
+    config => 't/hello/config.yml',
+    name   => 'hello',
+    source => 't/hello/Acme-Hello-0.03.tar.gz'
+);
+isa_ok( $bpb->backend, 'BPB::Backend::SVK' );
+
+$bpb->backend->initialize( name => 'hello' );
+my @dirs = sort `svk ls //__bpb/hello`;
+chomp @dirs;
+is_deeply( [@dirs], [ 'bin/', 'bpb/', 'dists/', 'etc/', 'scripts/', 't/' ] );
+
+my $source_dir = $bpb->source->run();
+$bpb->backend->import( name => 'hello', source => $source_dir );
+ok( grep { /Build\.PL/ } `svk ls //__bpb/hello/dists/Acme-Hello`,
+    'imported ok' );
+
+my $script_dir = tempdir( CLEANUP => 1 );
+copy('t/hello/scripts/build', $script_dir );
+copy('t/hello/scripts/require.yml', $script_dir );
+
+$bpb->backend->import(
+    name         => 'hello',
+    source       => $source_dir,
+    build_script => $script_dir,
+);
+ok( grep { /Build\.PL/ } `svk cat //__bpb/hello/scripts/Acme-Hello/build`, 'build script ok' );
+

Added: bpsbuilder/BPB/t/hello/config.t
==============================================================================
--- (empty file)
+++ bpsbuilder/BPB/t/hello/config.t	Thu Jan 17 05:39:04 2008
@@ -0,0 +1,34 @@
+use strict;
+use warnings;
+
+use Test::More tests => 4;
+use BPB::Config;
+
+my $config = BPB::Config->new(
+    config => 't/hello/config.yml',
+    name   => 'hello',
+);
+
+isa_ok( $config, 'BPB::Config' );
+is_deeply( $config->list(), ["hello\t//__bpb/hello"], 'list method works' );
+is(
+    $config->list( name => 'hello' ),
+    "hello\t//__bpb/hello",
+    'list method with name arg works'
+);
+is_deeply(
+    $config->name,
+    {
+        'source'  => { 'min_perl_version' => '5.008008' },
+        'backend' => {
+            'repository' => '//__bpb/hello',
+            'module'     => 'SVK',
+        },
+        'build' => {
+            'perl'      => 'perl',
+            'skip_test' => '0',
+        },
+        'log' => { 'level' => 'FATAL', },
+    },
+    'name method works'
+);

Added: bpsbuilder/BPB/t/hello/config.yml
==============================================================================
--- (empty file)
+++ bpsbuilder/BPB/t/hello/config.yml	Thu Jan 17 05:39:04 2008
@@ -0,0 +1,11 @@
+hello:
+    log:
+        level: FATAL
+    backend:
+        module: SVK
+        repository: '//__bpb/hello'
+    source:
+        min_perl_version: 5.008008
+    build:
+        perl: 'perl'
+        skip_test: 0

Added: bpsbuilder/BPB/t/hello/hello.t
==============================================================================
--- (empty file)
+++ bpsbuilder/BPB/t/hello/hello.t	Thu Jan 17 05:39:04 2008
@@ -0,0 +1,22 @@
+use strict;
+use warnings;
+
+use Test::More tests => 8;
+
+use BPB;
+
+my $bpb = BPB->new(
+    config => 't/hello/config.yml',
+    name   => 'hello',
+    source => 'Acme::Hello',
+);
+isa_ok( $bpb,          'BPB' );
+isa_ok( $bpb->config,  'BPB::Config' );
+isa_ok( $bpb->backend, 'BPB::Backend::SVK' );
+isa_ok( $bpb->source,  'BPB::Source::CPAN' );
+isa_ok( $bpb->build,   'BPB::Build' );
+
+for (qw/source backend build/) {
+    isa_ok( $bpb->$_->log, 'Log::Log4perl::Logger' );
+}
+

Added: bpsbuilder/BPB/t/hello/scripts/build
==============================================================================
--- (empty file)
+++ bpsbuilder/BPB/t/hello/scripts/build	Thu Jan 17 05:39:04 2008
@@ -0,0 +1,4 @@
+configure: /usr/bin/perl Build.PL --install_base=%%INSTALL_BASE%%
+make: ./Build
+test: ./Build test
+install: ./Build install

Added: bpsbuilder/BPB/t/hello/scripts/require.yml
==============================================================================
--- (empty file)
+++ bpsbuilder/BPB/t/hello/scripts/require.yml	Thu Jan 17 05:39:04 2008
@@ -0,0 +1,2 @@
+--- {}
+

Added: bpsbuilder/BPB/t/hello/source.t
==============================================================================
--- (empty file)
+++ bpsbuilder/BPB/t/hello/source.t	Thu Jan 17 05:39:04 2008
@@ -0,0 +1,38 @@
+use strict;
+use warnings;
+
+use Test::More tests => 16;
+
+use BPB;
+
+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',
+    'Acme::Hello'                        => 'CPAN',
+    't/hello/Acme-Hello-0.03.tar.gz'     => 'Compressed',
+    't/hello'                            => 'Directory',
+);
+
+for ( keys %source ) {
+    my $bpb = BPB->new(
+        config => 't/hello/config.yml',
+        name   => 'hello',
+        source => $_,
+    );
+    isa_ok( $bpb, 'BPB' );
+    isa_ok( $bpb->source, "BPB::Source::$source{$_}" );
+}
+
+my $bpb = BPB->new(
+    config => 't/hello/config.yml',
+    name   => 'hello',
+    source => 't/hello/Acme-Hello-0.03.tar.gz'
+);
+
+my $source_dir = $bpb->source->run();
+
+ok( -e File::Spec->catfile( $source_dir, 'lib', 'Acme', 'Hello.pm' ) );
+ok( -e File::Spec->catfile( $source_dir, 'META.yml' ) );
+



More information about the Bps-public-commit mailing list