@@ -14,6 +14,7 @@ my $build = Module::Build->new (
requires => {
'perl' => '5.6.0',
'UNIVERSAL::require' => 0,
+ 'version' => 0,
},
recommends => {
'Devel::CheckOS' => 0,
@@ -1,5 +1,16 @@
Revision history for Perl extension Test-Compile
+v1.0.1 2014-03-20 (Evan Giles <egiles@cpan.org>)
+ - Fix stupid omission from the MANAIFEST (tests failed everywhere)
+
+v1.0.0 2014-03-19 (Evan Giles <egiles@cpan.org>)
+ - Try to use Sematic Versioning - http://semver.org
+ - Add diagnostics on compilation failure (Micheal G. Schwern)
+ - require, don't use (Micheal G. Schwern)
+ - Test for truth, not an integer. (Micheal G. Schwern)
+ - Small POD fix (Micheal G. Schwern)
+ - OS X is not a crazy OS from a redirection POV (Micheal G. Schwern)
+
0.24 2013 02 22 (Evan Giles <egiles@cpan.org>)
- Update POD to explain more problems with Test::Compile
@@ -21,10 +21,11 @@ t/200-pl-file-ok-vms.t
t/200-taint.t
t/scripts/CVS/Ignore.pm
t/scripts/CVS/taint2.pl
-t/scripts/Module.pm
-t/scripts/Module2.pm
t/scripts/failure.pl
+t/scripts/LethalImport.pm
t/scripts/lib.pl
+t/scripts/Module2.pm
+t/scripts/Module.pm
t/scripts/subdir/success.pl
t/scripts/taint.pl
xt/author/00-compile.t
@@ -25,18 +25,19 @@
},
"requires" : {
"UNIVERSAL::require" : "0",
- "perl" : "v5.6.0"
+ "perl" : "v5.6.0",
+ "version" : "0"
}
}
},
"provides" : {
"Test::Compile" : {
"file" : "lib/Test/Compile.pm",
- "version" : "0.24"
+ "version" : "v1.0.1"
},
"Test::Compile::Internal" : {
"file" : "lib/Test/Compile/Internal.pm",
- "version" : "0.24"
+ "version" : "v1.0.1"
}
},
"release_status" : "stable",
@@ -48,5 +49,5 @@
"url" : "http://github.com/egiles/test-compile"
}
},
- "version" : "0.24"
+ "version" : "v1.0.1"
}
@@ -15,16 +15,17 @@ name: Test-Compile
provides:
Test::Compile:
file: lib/Test/Compile.pm
- version: 0.24
+ version: v1.0.1
Test::Compile::Internal:
file: lib/Test/Compile/Internal.pm
- version: 0.24
+ version: v1.0.1
recommends:
Devel::CheckOS: 0
requires:
UNIVERSAL::require: 0
perl: v5.6.0
+ version: 0
resources:
license: http://dev.perl.org/licenses/
repository: http://github.com/egiles/test-compile
-version: 0.24
+version: v1.0.1
@@ -6,7 +6,8 @@ WriteMakefile
'NAME' => 'Test::Compile',
'VERSION_FROM' => 'lib/Test/Compile.pm',
'PREREQ_PM' => {
- 'UNIVERSAL::require' => 0
+ 'UNIVERSAL::require' => 0,
+ 'version' => 0
},
'INSTALLDIRS' => 'site',
'EXE_FILES' => [],
@@ -2,7 +2,7 @@ DESCRIPTION
Test::Compile is a Perl module that lets you check whether a Perl module
or script compiles properly, and report its results in standard
Test::Simple fashion. It can test all Perl modules in a distribution, as
- well as single module or script files.
+ well as single module or script files.
DEPENDANCIES
Requires perl v5.6.0, and
@@ -17,7 +17,7 @@ INSTALLATION
./Build install
COPYRIGHT AND LICENSE
- Copyright 2007-2013.
+ Copyright 2007-2014.
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
@@ -7,8 +7,7 @@ use strict;
use File::Spec;
use UNIVERSAL::require;
use Test::Builder;
-
-our $VERSION = '0.24';
+use version; our $VERSION = qv("v1.0.1");
=head1 NAME
@@ -172,10 +171,11 @@ sub pl_file_compiles {
Returns true if C<$file> compiles as a perl module.
=back
+
=cut
sub pm_file_compiles {
- my ($self,$file) = @_;
+ my ($self,$file,%args) = @_;
return $self->_run_closure(
sub{
@@ -185,8 +185,15 @@ sub pm_file_compiles {
$module =~ s![/\\]!::!g;
$module =~ s/\.pm$//;
- $module->use;
- return ($@ ? 0 : 1);
+ return 1 if $module->require;
+
+ $self->{test}->diag("Compilation of $module failed: $@")
+ if $self->verbose();
+ return 0;
+ }
+ else {
+ $self->{test}->diag("$file could not be found") if $self->verbose();
+ return 0;
}
}
);
@@ -6,8 +6,8 @@ use strict;
use UNIVERSAL::require;
use Test::Compile::Internal;
+use version; our $VERSION = qv("v1.0.1");
-our $VERSION = '0.24';
my $Test = Test::Compile::Internal->new();
_verbose(1);
@@ -11,13 +11,14 @@ my $internal = Test::Compile::Internal->new();
my @files;
@files = sort $internal->all_pm_files();
-is(scalar @files,2,'Found correct number of modules in default location');
+is(@files,2,'Found correct number of modules in default location');
like($files[0],qr/lib.Test.Compile.pm/,'Found module: Compile.pm');
like($files[1],qr/lib.Test.Compile.Internal.pm/,'Found module: Internal.pm');
@files = sort $internal->all_pm_files('t/scripts');
-is(scalar @files,2,'Found correct number of modules in t/scripts');
-like($files[0],qr/t.scripts.Module.pm/,'Found module: Module.pm');
-like($files[1],qr/t.scripts.Module2.pm/,'Found module: Module2.pm');
+is(@files,3,'Found correct number of modules in t/scripts');
+like($files[0],qr/t.scripts.LethalImport.pm/,'Found module: Module2.pm');
+like($files[1],qr/t.scripts.Module.pm/,'Found module: Module.pm');
+like($files[2],qr/t.scripts.Module2.pm/,'Found module: Module2.pm');
$internal->done_testing();
@@ -7,15 +7,20 @@ use Test::More;
use Test::Compile::Internal;
my $internal = Test::Compile::Internal->new();
+$internal->verbose(0);
my $yes = $internal->pm_file_compiles('t/scripts/Module.pm');
-is($yes,1,"Module.pm should compile");
+ok($yes, "Module.pm should compile");
my $no = $internal->pm_file_compiles('t/scripts/CVS/Ignore.pm');
-is($no,0,"Ignore.pm should not compile");
+ok(!$no, "Ignore.pm should not compile");
my $notfound = $internal->pm_file_compiles('t/scripts/NotFound.pm');
-is($notfound,0,"NotFound.pm should not compile");
+ok(!$notfound, "NotFound.pm should not compile");
+note "Does not call import"; {
+ my $result = $internal->pm_file_compiles('t/scripts/LethalImport.pm');
+ ok $result, "Does not call import() routines";
+}
done_testing();
@@ -8,7 +8,7 @@ use Test::More;
use Test::Compile::Internal;
plan skip_all => "I don't know how to redirect STDERR on your crazy OS"
- unless $^O =~ m/linux|.*bsd|solaris/;
+ unless $^O =~ m/linux|.*bsd|solaris|darwin/;
sub makeAnError {
@@ -0,0 +1,5 @@
+package t::scripts::LethalImport;
+
+sub import { die "All die"; }
+
+1;
@@ -6,6 +6,7 @@ BEGIN {
require Test::Builder;
require File::Spec;
require UNIVERSAL::require;
+ require version;
@INC = grep { $_ eq 'blib/lib' } @INC;
}
use Test::Compile;