Imported Upstream version 0.06
This commit is contained in:
28
xt/99-changes.t
Normal file
28
xt/99-changes.t
Normal file
@@ -0,0 +1,28 @@
|
||||
#!perl -w
|
||||
use warnings;
|
||||
use strict;
|
||||
use File::Find;
|
||||
use Test::More tests => 2;
|
||||
|
||||
=head1 PURPOSE
|
||||
|
||||
This test ensures that the Changes file
|
||||
mentions the current version and that a
|
||||
release date is mentioned as well
|
||||
|
||||
=cut
|
||||
|
||||
my $module = 'Archive::SevenZip';
|
||||
|
||||
(my $file = $module) =~ s!::!/!g;
|
||||
require "$file.pm";
|
||||
|
||||
my $version = sprintf '%0.2f', $module->VERSION;
|
||||
diag "Checking for version " . $version;
|
||||
|
||||
my $changes = do { local $/; open my $fh, 'Changes' or die $!; <$fh> };
|
||||
|
||||
ok $changes =~ /^(.*$version.*)$/m, "We find version $version";
|
||||
my $changes_line = $1;
|
||||
ok $changes_line =~ /$version\s+20\d{6}/, "We find a release date on the same line"
|
||||
or diag $changes_line;
|
||||
43
xt/99-compile.t
Normal file
43
xt/99-compile.t
Normal file
@@ -0,0 +1,43 @@
|
||||
#!perl -w
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
use File::Find;
|
||||
use Test::More;
|
||||
BEGIN {
|
||||
eval 'use Capture::Tiny ":all"; 1';
|
||||
if ($@) {
|
||||
plan skip_all => "Capture::Tiny needed for testing";
|
||||
exit 0;
|
||||
};
|
||||
};
|
||||
|
||||
plan 'no_plan';
|
||||
|
||||
my $last_version = undef;
|
||||
|
||||
sub check {
|
||||
return if (! m{(\.pm|\.pl) \z}xmsi);
|
||||
|
||||
my ($stdout, $stderr, $exit) = capture(sub {
|
||||
system( $^X, '-Mblib', '-wc', $_ );
|
||||
});
|
||||
|
||||
s!\s*\z!!
|
||||
for ($stdout, $stderr);
|
||||
|
||||
if( $exit ) {
|
||||
diag $exit;
|
||||
fail($_);
|
||||
} elsif( $stderr ne "$_ syntax OK") {
|
||||
diag $stderr;
|
||||
fail($_);
|
||||
} else {
|
||||
pass($_);
|
||||
};
|
||||
}
|
||||
|
||||
find({wanted => \&check, no_chdir => 1},
|
||||
grep { -d $_ }
|
||||
'blib', 'scripts', 'examples', 'bin', 'lib'
|
||||
);
|
||||
31
xt/99-manifest.t
Normal file
31
xt/99-manifest.t
Normal file
@@ -0,0 +1,31 @@
|
||||
use strict;
|
||||
use Test::More;
|
||||
|
||||
# Check that MANIFEST and MANIFEST.skip are sane :
|
||||
|
||||
use File::Find;
|
||||
use File::Spec;
|
||||
|
||||
my @files = qw( MANIFEST MANIFEST.SKIP );
|
||||
plan tests => scalar @files * 4
|
||||
+1 # MANIFEST existence check
|
||||
;
|
||||
|
||||
for my $file (@files) {
|
||||
ok(-f $file, "$file exists");
|
||||
open F, "<$file"
|
||||
or die "Couldn't open $file : $!";
|
||||
my @lines = <F>;
|
||||
is_deeply([grep(/^$/, @lines)],[], "No empty lines in $file");
|
||||
is_deeply([grep(/^\s+$/, @lines)],[], "No whitespace-only lines in $file");
|
||||
is_deeply([grep(/^\s*\S\s+$/, @lines)],[],"No trailing whitespace on lines in $file");
|
||||
|
||||
if ($file eq 'MANIFEST') {
|
||||
chomp @lines;
|
||||
is_deeply([grep { s/\s.*//; ! -f } @lines], [], "All files in $file exist")
|
||||
or do { diag "$_ is mentioned in $file but doesn't exist on disk" for grep { ! -f } @lines };
|
||||
};
|
||||
|
||||
close F;
|
||||
};
|
||||
|
||||
17
xt/99-minimumversion.t
Normal file
17
xt/99-minimumversion.t
Normal file
@@ -0,0 +1,17 @@
|
||||
#!perl -w
|
||||
use strict;
|
||||
use Test::More;
|
||||
|
||||
eval {
|
||||
require Test::MinimumVersion::Fast;
|
||||
Test::MinimumVersion::Fast->import;
|
||||
};
|
||||
|
||||
my @files;
|
||||
|
||||
if ($@) {
|
||||
plan skip_all => "Test::MinimumVersion::Fast required for testing minimum Perl version";
|
||||
}
|
||||
else {
|
||||
all_minimum_version_from_metayml_ok();
|
||||
}
|
||||
36
xt/99-pod.t
Normal file
36
xt/99-pod.t
Normal file
@@ -0,0 +1,36 @@
|
||||
use Test::More;
|
||||
|
||||
# Check our Pod
|
||||
# The test was provided by Andy Lester,
|
||||
# who stole it from Brian D. Foy
|
||||
# Thanks to both !
|
||||
|
||||
use File::Spec;
|
||||
use File::Find;
|
||||
use strict;
|
||||
|
||||
eval {
|
||||
require Test::Pod;
|
||||
Test::Pod->import;
|
||||
};
|
||||
|
||||
my @files;
|
||||
|
||||
if ($@) {
|
||||
plan skip_all => "Test::Pod required for testing POD";
|
||||
}
|
||||
elsif ($Test::Pod::VERSION < 0.95) {
|
||||
plan skip_all => "Test::Pod 0.95 required for testing POD";
|
||||
}
|
||||
else {
|
||||
my $blib = File::Spec->catfile(qw(blib lib));
|
||||
find(\&wanted, grep { -d } ($blib, 'bin'));
|
||||
plan tests => scalar @files;
|
||||
foreach my $file (@files) {
|
||||
pod_file_ok($file);
|
||||
}
|
||||
}
|
||||
|
||||
sub wanted {
|
||||
push @files, $File::Find::name if /\.p(l|m|od)$/;
|
||||
}
|
||||
47
xt/99-todo.t
Normal file
47
xt/99-todo.t
Normal file
@@ -0,0 +1,47 @@
|
||||
use Test::More;
|
||||
use File::Spec;
|
||||
use File::Find;
|
||||
use strict;
|
||||
|
||||
# Check that all files do not contain any
|
||||
# lines with "XXX" - such markers should
|
||||
# either have been converted into Todo-stuff
|
||||
# or have been resolved.
|
||||
# The test was provided by Andy Lester.
|
||||
|
||||
my @files;
|
||||
my $blib = File::Spec->catfile(qw(blib lib));
|
||||
find(\&wanted, grep { -d } ($blib, 'bin'));
|
||||
plan tests => 2* @files;
|
||||
foreach my $file (@files) {
|
||||
source_file_ok($file);
|
||||
}
|
||||
|
||||
sub wanted {
|
||||
push @files, $File::Find::name if /\.p(l|m|od)$/;
|
||||
}
|
||||
|
||||
sub source_file_ok {
|
||||
my $file = shift;
|
||||
|
||||
open( my $fh, "<$file" ) or die "Can't open $file: $!";
|
||||
my @lines = <$fh>;
|
||||
close $fh;
|
||||
|
||||
my $n = 0;
|
||||
for ( @lines ) {
|
||||
++$n;
|
||||
s/^/$file ($n): /;
|
||||
}
|
||||
|
||||
my @x = grep /XXX/, @lines;
|
||||
|
||||
if ( !is( scalar @x, 0, "Looking for XXXes in $file" ) ) {
|
||||
diag( $_ ) for @x;
|
||||
}
|
||||
@x = grep /<<<|>>>/, @lines;
|
||||
|
||||
if ( !is( scalar @x, 0, "Looking for <<<<|>>>> in $file" ) ) {
|
||||
diag( $_ ) for @x;
|
||||
}
|
||||
}
|
||||
37
xt/99-unix-text.t
Normal file
37
xt/99-unix-text.t
Normal file
@@ -0,0 +1,37 @@
|
||||
use Test::More;
|
||||
|
||||
# Check that all released module files are in
|
||||
# UNIX text format
|
||||
|
||||
use File::Spec;
|
||||
use File::Find;
|
||||
use strict;
|
||||
|
||||
my @files;
|
||||
|
||||
my $blib = File::Spec->catfile(qw(blib lib));
|
||||
find(\&wanted, grep { -d } ($blib, 'bin'));
|
||||
plan tests => scalar @files;
|
||||
foreach my $file (@files) {
|
||||
unix_file_ok($file);
|
||||
}
|
||||
|
||||
sub wanted {
|
||||
push @files, $File::Find::name if /\.p(l|m|od)$/;
|
||||
}
|
||||
|
||||
sub unix_file_ok {
|
||||
my ($filename) = @_;
|
||||
local $/;
|
||||
open F, "< $filename"
|
||||
or die "Couldn't open '$filename' : $!\n";
|
||||
binmode F;
|
||||
my $content = <F>;
|
||||
|
||||
my $i;
|
||||
my @lines = grep { /\x0D\x0A$/sm } map { sprintf "%s: %s\x0A", $i++, $_ } split /\x0A/, $content;
|
||||
unless (is(scalar @lines, 0,"'$filename' contains no windows newlines")) {
|
||||
diag $_ for @lines;
|
||||
};
|
||||
close F;
|
||||
};
|
||||
51
xt/99-versions.t
Normal file
51
xt/99-versions.t
Normal file
@@ -0,0 +1,51 @@
|
||||
#!perl -w
|
||||
|
||||
# Stolen from ChrisDolan on use.perl.org
|
||||
# http://use.perl.org/comments.pl?sid=29264&cid=44309
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
use File::Find;
|
||||
use Test::More;
|
||||
BEGIN {
|
||||
eval 'use File::Slurp; 1';
|
||||
if ($@) {
|
||||
plan skip_all => "File::Slurp needed for testing";
|
||||
exit 0;
|
||||
};
|
||||
};
|
||||
|
||||
plan 'no_plan';
|
||||
|
||||
my $last_version = undef;
|
||||
|
||||
sub check {
|
||||
return if (! m{blib/script/}xms && ! m{\.pm \z}xms);
|
||||
|
||||
my $content = read_file($_);
|
||||
|
||||
# only look at perl scripts, not sh scripts
|
||||
return if (m{blib/script/}xms && $content !~ m/\A \#![^\r\n]+?perl/xms);
|
||||
|
||||
my @version_lines = $content =~ m/ ( [^\n]* \$VERSION \s* = [^=] [^\n]* ) /gxms;
|
||||
if (@version_lines == 0) {
|
||||
fail($_);
|
||||
}
|
||||
for my $line (@version_lines) {
|
||||
$line =~ s/^\s+//;
|
||||
$line =~ s/\s+$//;
|
||||
if (!defined $last_version) {
|
||||
$last_version = shift @version_lines;
|
||||
diag "Checking for $last_version";
|
||||
pass($_);
|
||||
} else {
|
||||
is($line, $last_version, $_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
find({wanted => \&check, no_chdir => 1}, 'blib');
|
||||
|
||||
if (! defined $last_version) {
|
||||
fail('Failed to find any files with $VERSION');
|
||||
}
|
||||
Reference in New Issue
Block a user