Skip to content

Commit

Permalink
more build testing and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
xdg committed Dec 2, 2009
1 parent d740387 commit 648e1b2
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
1 change: 1 addition & 0 deletions bin/btiny
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!perl
use 5.006;
use strict;
use warnings;
Expand Down
4 changes: 3 additions & 1 deletion lib/Acme/Module/Build/Tiny.pm
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ sub build {
(map {$_=>"blib/$_"} _files('lib')),
(map {;"bin/$_"=>"blib/script/$_"} map {s{^bin/}{}; $_} _files('bin')),
};
ExtUtils::Install::pm_to_blib($map, 'blib/lib/auto') || 1;
ExtUtils::Install::pm_to_blib($map, 'blib/lib/auto');
ExtUtils::MM->fixin($_), chmod(0555, $_) for _files('blib/script');
return 1;
}

sub test {
Expand Down
1 change: 1 addition & 0 deletions t/btiny.t
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!perl
use strict;
use warnings;
use File::pushd 1.00 qw(tempd);
Expand Down
25 changes: 23 additions & 2 deletions t/simple.t
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use Test::More 0.86;
use lib 't/lib';
use DistGen qw/undent/;

plan tests => 9;
plan tests => 17;

#--------------------------------------------------------------------------#
# fixtures
Expand All @@ -16,13 +16,17 @@ plan tests => 9;
my $dist = DistGen->new(name => 'Foo::Bar');
$dist->chdir_in;
$dist->add_file('bin/simple', undent(<<" ---"));
use Simple;
#!perl
use Foo::Bar;
print Simple->VERSION . "\n";
---
$dist->regen;

my ($guts, $ec);

sub _mod2pm { (my $mod = shift) =~ s{::}{/}g; return "$mod.pm" }
sub _path2mod { (my $pm = shift) =~ s{/}{::}g; return substr $pm, 5, -3 }
sub _mod2dist { (my $mod = shift) =~ s{::}{-}g; return $mod; }
sub _slurp { do { local (@ARGV,$/)=$_[0]; <> } }

#--------------------------------------------------------------------------#
Expand Down Expand Up @@ -50,6 +54,23 @@ sub _slurp { do { local (@ARGV,$/)=$_[0]; <> } }
ok( -d 'blib', "created blib" );
ok( -d 'blib/lib', "created blib/lib" );
ok( -d 'blib/script', "created blib/script" );

# check pm
my $pmfile = _mod2pm($dist->name);
ok( -f 'blib/lib/' . $pmfile, "$dist->{name} copied to blib" );
is( _slurp("lib/$pmfile"), _slurp("blib/lib/$pmfile"), "pm contents are correct" );
ok( ! -w "blib/lib/$pmfile", "pm file in blib is readonly" );

# check bin
ok( -f 'blib/script/simple', "bin/simple copied to blib" );
like( _slurp("blib/script/simple"), '/' .quotemeta(_slurp("blib/script/simple")) . "/",
"blib/script/simple contents are correct" );
ok( ! -w "blib/script/simple", "blib/script/simple is readonly" );
ok( -x "blib/script/simple", "blib/script/simple is executable" );
open my $fh, "<", "blib/script/simple";
my $line = <$fh>;
like( $line, qr/\A#!\Q$^X\E/, "blib/script/simple has shebang line with \$^X" );

}


0 comments on commit 648e1b2

Please sign in to comment.