Skip to content

Commit

Permalink
Module::Build testing
Browse files Browse the repository at this point in the history
  • Loading branch information
haarg committed Oct 28, 2014
1 parent 2b56aaa commit 11e5ae7
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/tap.bash
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ function plan {
elif [ "$1" == "no" ]; then
_tap_planned="$1"
return 0
elif [ "$1" == "0" ]; then
_tap_planned="0"
echo "1..0 # SKIP $2"
trap EXIT
exit 0
else
_tap_planned="$1"
echo "1..$1"
Expand Down
22 changes: 22 additions & 0 deletions t/mb.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
. lib/tap.bash

if ! perl -e'require 5.008' 2>/dev/null; then
plan 0 'Perl 5.8 required'
fi

(
cd t/mb
set -e
set -x
. $PERLBREW_ROOT/etc/bashrc
. $HELPERS_ROOT/init --auto
cpanm --quiet --installdeps --notest .
perl Build.PL && ./Build && ./Build test
) 2>&1 | note

ok ${PIPESTATUS[0]} 'Module::Build dist with --auto'

done_testing

# vim: ft=sh
19 changes: 19 additions & 0 deletions t/mb/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/MANIFEST
/MANIFEST.bak
/MANIFEST.SKIP
/MANIFEST.SKIP.bak
/Build
/_build/
/META.*
/MYMETA.*
/Makefile
/Makefile.old
/README
/blib/
/pm_to_blib
*~
*#
.#*
/Travis-Test-Dist-MB-*/
/Travis-Test-Dist-MB-*.tar.gz
/cover_db/
14 changes: 14 additions & 0 deletions t/mb/Build.PL
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use strict;
use warnings;
use Module::Build;

Module::Build->new(
module_name => 'Travis::Test::Dist::MB',
dist_version => '0.01',
dist_author => 'SOMEONE',
dist_abstract => 'test module',
license => 'perl',
requires => {
'Devel::GlobalPhase' => 0,
},
)->create_build_script;
1 change: 1 addition & 0 deletions t/mb/Makefile.PL
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
die "This fine shouldn't be used.";
14 changes: 14 additions & 0 deletions t/mb/t/prereqs.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use strict;
use warnings;
use Test::More tests => 1;

for my $prereq (
['Devel::GlobalPhase'],
) {
my ($mod, $installed) = @$prereq;
$installed = 1 if ! defined $installed;
(my $file = "$mod.pm") =~ s{::}{/}g;
my $worked = eval { require $file };
$worked = !$worked if !$installed;
ok $worked, "$mod was " . ($installed ? '' : 'not ') . "installed";
}

0 comments on commit 11e5ae7

Please sign in to comment.