Test-Compile-0.24000755001750001750 012111631534 13006 5ustar00evanevan000000000000Test-Compile-0.24/Build.PL000555001750001750 131312111631534 14440 0ustar00evanevan000000000000#! /usr/bin/perl use strict; use warnings; use Module::Build; my $build = Module::Build->new ( module_name => 'Test::Compile', abstract_from => 'lib/Test/Compile.pm', dist_author => 'Evan Giles ', license => 'perl', configure_requires => { 'Module::Build' => 0.38 }, requires => { 'perl' => '5.6.0', 'UNIVERSAL::require' => 0, }, recommends => { 'Devel::CheckOS' => 0, }, create_makefile_pl => 'traditional', meta_merge => { resources => { repository => "http://github.com/egiles/test-compile", } }, add_to_cleanup => [ 'Makefile.PL', 'META.yml' ], ); $build->create_build_script; Test-Compile-0.24/MANIFEST000444001750001750 150312111631534 14273 0ustar00evanevan000000000000Changes lib/Test/Compile.pm lib/Test/Compile/Internal.pm LICENSE Makefile.PL Build.PL MANIFEST This list of files META.yml README t/100-internal-all-pl-files.t t/100-internal-all-pm-files.t t/100-internal-basic.t t/100-internal-is-in-taint-mode.t t/100-internal-pl-file-compiles.t t/100-internal-pm-file-compiles.t t/100-internal-verbose.t t/200-basic.t t/200-lib.t t/200-pl-file-ok.t 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/lib.pl t/scripts/subdir/success.pl t/scripts/taint.pl xt/author/00-compile.t xt/author/01_perl_critic.t xt/author/02_pod.t xt/author/04_pod_coverage.t xt/author/07_portability_files.t xt/author/08_synopsis.t xt/author/10_has_version.t xt/author/99-version.t xt/author/perlcriticrc META.json Test-Compile-0.24/META.json000444001750001750 232612111631534 14567 0ustar00evanevan000000000000{ "abstract" : "Check whether Perl files compile correctly.", "author" : [ "Evan Giles " ], "dynamic_config" : 1, "generated_by" : "Module::Build version 0.38, CPAN::Meta::Converter version 2.120921", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Test-Compile", "prereqs" : { "configure" : { "requires" : { "Module::Build" : "0.38" } }, "runtime" : { "recommends" : { "Devel::CheckOS" : "0" }, "requires" : { "UNIVERSAL::require" : "0", "perl" : "v5.6.0" } } }, "provides" : { "Test::Compile" : { "file" : "lib/Test/Compile.pm", "version" : "0.24" }, "Test::Compile::Internal" : { "file" : "lib/Test/Compile/Internal.pm", "version" : "0.24" } }, "release_status" : "stable", "resources" : { "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "url" : "http://github.com/egiles/test-compile" } }, "version" : "0.24" } Test-Compile-0.24/Changes000444001750001750 1312012111631534 14453 0ustar00evanevan000000000000Revision history for Perl extension Test-Compile 0.24 2013 02 22 (Evan Giles ) - Update POD to explain more problems with Test::Compile 0.23 2013.01.23 (Evan Giles ) - Update Copyright for 2013 - CPAN-RT #82887, Sébastien Aperghis-Tramoni - Correct handling of PERL5LIB - fix regexp to detect taint mode 0.22 2012.10.31 (Evan Giles ) - Set verbose on for the Test::Compile library (rt80187) 0.21 2012.09.05 (Evan Giles ) - Finally test that the verbose method actaully works. - Update the POD - mostly to simplify it. - Remove redundant code, yet more tests. - Test::Compile::Internal is no longer 'beta'. 0.20 2012.08.08 (Evan Giles ) - Tests should also work outside unix (rt78810) 0.19 2012.08.03 (Evan Giles ) - Introduce Test::Compile::Internal.pm - Utilise Test::Compile::Internal to get better test coverage 0.18 2012.07.16 (Evan Giles ) - Fix a warning that leaks out (rt78363) 0.17 2012.02.25 (Evan Giles ) - Another few tests for taint logic 0.16_1 2012.02.23 (Evan Giles ) - Reapply patches from Nicholas Bamber (rt55837 & rt72557) 0.16 2012.02.21 (Evan Giles ) - Skip tests if there are not files to test (rt69297) - Handle taint mode correctly (rt55837) - Add 'blib/lib' to the search path for scripts (rt72557) 0.15 Fri 2012.02.03 20:33:55 NZST (Evan Giles ) - Fork, and run compile tests in the child process (rt73290 & rt73291) 0.14 Tue 2012.01.10 20:03:24 NZST (Evan Giles ) - Convert to Module::Build - Improved test for pl_file_ok() - Better test coverage (which files do we process, failed to compile, etc) - Remove duplicate code 0.13 Tue 2010.03.02 15:57:02 CET (Marcel Gruenauer ) - require Test::More 0.88 so done_testing works without no_plan (thanks jozef) 0.12 Thu 2010.02.11 15:16:22 CET (Marcel Gruenauer ) - updated skeleton files - recommend, not require, Devel::CheckOS - only needed for VMS anyway 0.11 Tue 2009.12.08 12:19:25 CET (Marcel Gruenauer ) - made author tests more robust 0.10 Thu 2009.10.08 22:29:11 CEST (Marcel Gruenauer ) - re-release with fixed inc::Module::Install::ReadmeMarkdownFromPod 0.09 Wed 2009.10.07 00:57:14 CEST (Marcel Gruenauer ) - Always report name of .pl files (thanks xsawyerx). - pm_file_ok() can now handle Windows paths (thanks clonezone). - fixed version number used in documentation (thanks JKUTEJ). - Changed dist style and Changes back to standard. People didn't like it - the nail that sticks out gets hammered down. - Added standard test files; this will also help with CPANTS. 0.08 Thu, 29 May 2008 12:08:32 -0000 (Marcel Gruenauer ) - set the version to 0.08 - we now check for Devel::CheckOS with UNIVERSAL::require so we don't use() it so Devel::CheckOS won't be included when using Test::Compile as part of Module::Install::StandardTests - .shipit: fixed svk.tagpattern 0.07 Thu, 06 Dec 2007 19:24:25 -0000 (Marcel Gruenauer ) - set the version to 0.07 - fixed bug in pl_file_ok() where a SKIP block was used when Test->skip() should have been used - added t/04_pl_file_ok-vms.t to verify that - updated MANIFEST - added t/04_pl_file_ok-vms.t 0.06 Thu, 06 Dec 2007 13:16:02 -0000 (Marcel Gruenauer ) - Converted Changes file to YAML style - .shipit: added Twitter step - Makefile.PL: added auto_install() and process_templates() - lib/*: converted to template - updated MANIFEST - updated t/perlcriticrc - added capability to test scripts as well (thanks Sagar R. Shah) - added t/03_pl_file_ok.t - added t/scripts - tags: NEWFEATURE 0.05 Sun, 21 Oct 2007 13:40:23 +0200 (Marcel Gruenauer ) - no longer uses standard tests, since they require Test::Compile themselves. Instead, copied the standard tests's pod and pod coverage test files into this distribution. Thanks Andreas Koenig for catching that circular dependency. 0.04 Thu, 18 Oct 2007 10:09:39 +0200 (Marcel Gruenauer ) - fixed version requirement of Test::More 0.03 Wed, 03 Oct 2007 22:31:43 +0200 (Marcel Gruenauer ) - made things cleaner by using UNIVERSAL::require on the suspected module - The documentation now uses Test::More->builder->BAIL_OUT() in order to stop the testsuite from running if a compilation fails. Also, the documentation now urges that Test::Compile be mandatory (like Test::Exception often is) instead of optional (like Test::Pod often is). Thanks to Rob Kinyon for the suggestion. - bumped version numbers to '0.03' 0.02 Wed, 03 Oct 2007 18:30:17 +0200 (Marcel Gruenauer ) - made things cleaner by using UNIVERSAL::require on the suspected module name instead of do() on the file name, which introduced potential bugs by running at run time what would otherwise happen at compile time - bumped version numbers to '0.02' 0.01 Sat, 22 Sep 2007 23:35:34 +0200 (Marcel Gruenauer ) - original version Test-Compile-0.24/Makefile.PL000444001750001750 55312111631534 15100 0ustar00evanevan000000000000# Note: this file was auto-generated by Module::Build::Compat version 0.3800 require 5.006000; use ExtUtils::MakeMaker; WriteMakefile ( 'NAME' => 'Test::Compile', 'VERSION_FROM' => 'lib/Test/Compile.pm', 'PREREQ_PM' => { 'UNIVERSAL::require' => 0 }, 'INSTALLDIRS' => 'site', 'EXE_FILES' => [], 'PL_FILES' => {} ) ; Test-Compile-0.24/LICENSE000444001750001750 13612111631534 14130 0ustar00evanevan000000000000This software is dual-licensed under the Artistic license and the GPL, just like Perl itself. Test-Compile-0.24/README000444001750001750 122312111631534 14021 0ustar00evanevan000000000000DESCRIPTION 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. DEPENDANCIES Requires perl v5.6.0, and * UNIVERSAL::require INSTALLATION Standard process for building & installing modules: perl Build.PL ./Build ./Build test ./Build install COPYRIGHT AND LICENSE Copyright 2007-2013. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Test-Compile-0.24/META.yml000444001750001750 135112111631534 14414 0ustar00evanevan000000000000--- abstract: 'Check whether Perl files compile correctly.' author: - 'Evan Giles ' build_requires: {} configure_requires: Module::Build: 0.38 dynamic_config: 1 generated_by: 'Module::Build version 0.38, CPAN::Meta::Converter version 2.120921' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Test-Compile provides: Test::Compile: file: lib/Test/Compile.pm version: 0.24 Test::Compile::Internal: file: lib/Test/Compile/Internal.pm version: 0.24 recommends: Devel::CheckOS: 0 requires: UNIVERSAL::require: 0 perl: v5.6.0 resources: license: http://dev.perl.org/licenses/ repository: http://github.com/egiles/test-compile version: 0.24 Test-Compile-0.24/t000755001750001750 012111631534 13251 5ustar00evanevan000000000000Test-Compile-0.24/t/200-lib.t000444001750001750 63212111631534 14621 0ustar00evanevan000000000000#!perl -w use strict; use warnings; use Test::Compile; use Test::More ; plan skip_all => "Distribution hasn't been built yet" unless -d "blib/lib"; # lib.pl has a dodgy begin block which messes with @INC. # - that should force it to *only* look in blib/lib for # modules.. but it should still compile. See rt72557 # for more details. pl_file_ok('t/scripts/lib.pl', 'lib.pl compiles'); done_testing(); Test-Compile-0.24/t/200-basic.t000444001750001750 14212111631534 15130 0ustar00evanevan000000000000#!perl use strict; use warnings; use Test::More; require_ok('Test::Compile'); done_testing(); Test-Compile-0.24/t/100-internal-all-pl-files.t000444001750001750 126512111631534 20170 0ustar00evanevan000000000000#!perl use strict; use warnings; use File::Spec; use Test::More; use Test::Compile::Internal; my $internal = Test::Compile::Internal->new(); my @files; @files = sort $internal->all_pl_files(); is(scalar @files,0,'Found correct number of scripts in default location'); @files = sort $internal->all_pl_files('t/scripts'); is(scalar @files,4,'Found correct number of scripts in t/scripts'); like($files[0],qr/t.scripts.failure.pl/,'Found script: failure.pl'); like($files[1],qr/t.scripts.lib.pl/,'Found script: lib.pl'); like($files[2],qr/t.scripts.subdir.success.pl/,'Found script: success.pl'); like($files[3],qr/t.scripts.taint.pl/,'Found script: taint.pl'); $internal->done_testing(); Test-Compile-0.24/t/100-internal-basic.t000444001750001750 25212111631534 16743 0ustar00evanevan000000000000#!perl use strict; use warnings; use Test::More; require_ok('Test::Compile::Internal'); my $internal = new_ok('Test::Compile::Internal'); $internal->done_testing(); Test-Compile-0.24/t/200-taint.t000444001750001750 24712111631534 15174 0ustar00evanevan000000000000#!perl -w use strict; use warnings; use Test::More tests => 1; use Test::Compile; Test::Compile::_verbose(0); pl_file_ok('t/scripts/taint.pl', 'taint.pl compiles'); Test-Compile-0.24/t/100-internal-is-in-taint-mode.t000444001750001750 77112111631534 20746 0ustar00evanevan000000000000#!perl use strict; use warnings; use Test::More; use Test::Compile::Internal; my $internal = Test::Compile::Internal->new(); my $TAINT = $internal->_is_in_taint_mode('t/scripts/taint.pl'); is($TAINT,"T","Found taint flag in taint.pl"); my $taint = $internal->_is_in_taint_mode('t/scripts/CVS/taint2.pl'); is($taint,"t","Found taint warning flag in taint2.pl"); my $not = $internal->_is_in_taint_mode('t/scripts/subdir/success.pl'); is($not,"","No taint flags found in success.pl"); done_testing(); Test-Compile-0.24/t/100-internal-pm-file-compiles.t000444001750001750 73412111631534 21031 0ustar00evanevan000000000000#!perl use strict; use warnings; use Test::More; use Test::Compile::Internal; my $internal = Test::Compile::Internal->new(); my $yes = $internal->pm_file_compiles('t/scripts/Module.pm'); is($yes,1,"Module.pm should compile"); my $no = $internal->pm_file_compiles('t/scripts/CVS/Ignore.pm'); is($no,0,"Ignore.pm should not compile"); my $notfound = $internal->pm_file_compiles('t/scripts/NotFound.pm'); is($notfound,0,"NotFound.pm should not compile"); done_testing(); Test-Compile-0.24/t/100-internal-verbose.t000444001750001750 167012111631534 17354 0ustar00evanevan000000000000#!perl use strict; use warnings; use File::Spec; 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/; sub makeAnError { my ($verbose) = @_; my $internal = Test::Compile::Internal->new(); $internal->verbose($verbose); # Might output "$0 syntax OK" to STDERR $internal->pl_file_compiles($0); } sub main { my (@args) = @_; if ( @args && $args[0] =~ m/silent/ ) { makeAnError(0); return; } if ( @args && $args[0] =~ m/verbose/ ) { makeAnError(1); return; } my $lib = join(":",@INC); my $cmd = "PERL5LIB=$lib $^X $0"; my $silent = `$cmd silent 2>&1`; is($silent,"","no output when in silent mode"); my $verbose = `$cmd verbose 2>&1`; isnt($verbose,"","got some output when in verbose mode"); done_testing(); } main(@ARGV) unless caller; Test-Compile-0.24/t/200-pl-file-ok-vms.t000444001750001750 32012111631534 16607 0ustar00evanevan000000000000#!perl -w use strict; use warnings; use Test::More tests => 1; use Test::Compile; # cheap emulation $^O = 'VMS'; Test::Compile::_verbose(0); pl_file_ok('t/scripts/subdir/success.pl', 'success.pl compiles'); Test-Compile-0.24/t/100-internal-pl-file-compiles.t000444001750001750 135112111631534 21044 0ustar00evanevan000000000000#!perl use strict; use warnings; use Test::More; use Test::Compile::Internal; my $internal = Test::Compile::Internal->new(); my $yes = $internal->pl_file_compiles('t/scripts/subdir/success.pl'); is($yes,1,"success.pl should compile"); my $taint = $internal->pl_file_compiles('t/scripts/taint.pl'); is($taint,1,"taint.pl should compile - with -T enabled"); my $taint2 = $internal->pl_file_compiles('t/scripts/CVS/taint2.pl'); is($taint2,1,"taint2.pl should compile - with -t enabled"); my $no = $internal->pl_file_compiles('t/scripts/failure.pl'); is($no,0,"failure.pl should not compile"); my $not_found = $internal->pl_file_compiles('t/scripts/no_file_here.pl'); is($not_found,0,"no_file_here.pl should not compile"); done_testing(); Test-Compile-0.24/t/200-pl-file-ok.t000444001750001750 25612111631534 16014 0ustar00evanevan000000000000#!perl use strict; use warnings; use Test::More tests => 1; use Test::Compile; Test::Compile::_verbose(0); pl_file_ok('t/scripts/subdir/success.pl', 'success.pl compiles'); Test-Compile-0.24/t/100-internal-all-pm-files.t000444001750001750 126012111631534 20164 0ustar00evanevan000000000000#!perl use strict; use warnings; use Test::More; use Test::Compile::Internal; 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'); 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'); $internal->done_testing(); Test-Compile-0.24/t/scripts000755001750001750 012111631534 14740 5ustar00evanevan000000000000Test-Compile-0.24/t/scripts/failure.pl000444001750001750 26612111631534 17045 0ustar00evanevan000000000000 1: 1 1 1 - ^ found Number where operator expected (previous token underlined) 1: 1 1 1 - ^ found Number where operator expected (previous token underlined) 1 1 1 Test-Compile-0.24/t/scripts/Module2.pm000444001750001750 7112111631534 16700 0ustar00evanevan000000000000use strict; use warnings; sub func1 { return 2; } 1; Test-Compile-0.24/t/scripts/taint.pl000444001750001750 1612111631534 16506 0ustar00evanevan000000000000#!perl -T 1; Test-Compile-0.24/t/scripts/Module.pm000444001750001750 7112111631534 16616 0ustar00evanevan000000000000use strict; use warnings; sub func1 { return 1; } 1; Test-Compile-0.24/t/scripts/lib.pl000444001750001750 34012111631534 16155 0ustar00evanevan000000000000#!/usr/bin/perl BEGIN { require strict; require warnings; require Test::Builder; require File::Spec; require UNIVERSAL::require; @INC = grep { $_ eq 'blib/lib' } @INC; } use Test::Compile; sleep 1; Test-Compile-0.24/t/scripts/CVS000755001750001750 012111631534 15373 5ustar00evanevan000000000000Test-Compile-0.24/t/scripts/CVS/taint2.pl000444001750001750 1612111631534 17223 0ustar00evanevan000000000000#!perl -t 1; Test-Compile-0.24/t/scripts/CVS/Ignore.pm000444001750001750 612111631534 17225 0ustar00evanevan000000000000{ 1; Test-Compile-0.24/t/scripts/subdir000755001750001750 012111631534 16230 5ustar00evanevan000000000000Test-Compile-0.24/t/scripts/subdir/success.pl000444001750001750 312111631534 20303 0ustar00evanevan0000000000001; Test-Compile-0.24/lib000755001750001750 012111631534 13554 5ustar00evanevan000000000000Test-Compile-0.24/lib/Test000755001750001750 012111631534 14473 5ustar00evanevan000000000000Test-Compile-0.24/lib/Test/Compile.pm000444001750001750 1551012111631534 16600 0ustar00evanevan000000000000package Test::Compile; use 5.006; use warnings; use strict; use UNIVERSAL::require; use Test::Compile::Internal; our $VERSION = '0.24'; my $Test = Test::Compile::Internal->new(); _verbose(1); =head1 NAME Test::Compile - Check whether Perl files compile correctly. =head1 SYNOPSIS use Test::Compile; all_pm_files_ok(); =head1 DESCRIPTION C lets you check the whether your perl modules and scripts compile properly, and report its results in standard C fashion. The basic usage - as shown above, will find all pm files and test that they all compile. You can explicitly specify the list of directories to check, using the C function supplied: my @pmdirs = qw(blib script); all_pm_files_ok(all_pm_files(@pmdirs)); =cut sub import { my $self = shift; my $caller = caller; for my $func ( qw( pm_file_ok pl_file_ok all_pm_files all_pl_files all_pm_files_ok all_pl_files_ok ) ) { no strict 'refs'; *{ $caller . "::" . $func } = \&$func; } $Test->exported_to($caller); $Test->plan(@_); } =head1 FUNCTIONS =over 4 =item C Checks all the perl module files it can find for compilation errors. It uses C to find the perl module files. It also calls the C function for you (one test for each module), so you can't have already called C. Unfortunately, this also means you can't use this function with C. If this is a problem you should really be using L. Returns true if all Perl module files are ok, or false if any fail. Module authors can include the following in a F file and have C automatically find and check all Perl module files in a module distribution: #!perl -w use strict; use warnings; use Test::More; eval "use Test::Compile"; Test::More->builder->BAIL_OUT( "Test::Compile required for testing compilation") if $@; all_pm_files_ok(); =cut sub all_pm_files_ok { my @files = @_ ? @_ : all_pm_files(); $Test->plan(tests => scalar @files); my $ok = 1; for (@files) { pm_file_ok($_) or undef $ok; } $ok; } =item C Checks all the perl script files it can find for compilation errors. It uses C to find the perl script files. It also calls the C function for you (one test for each script), so you can't have already called C. Unfortunately, this also means you can't use this function with C. If this is a problem you should really be using L. Returns true if all Perl script files are ok, or false if any fail. Module authors can include the following in a F file and have C automatically find and check all Perl script files in a module distribution: #!perl -w use strict; use warnings; use Test::More; eval "use Test::Compile"; plan skip_all => "Test::Compile required for testing compilation" if $@; all_pl_files_ok(); =cut sub all_pl_files_ok { my @files = @_ ? @_ : all_pl_files(); $Test->skip_all("no pl files found") unless @files; $Test->plan(tests => scalar @files); my $ok = 1; for (@files) { pl_file_ok($_) or undef $ok; } $ok; } =item C C will okay the test if $filename compiles as a perl module. The optional second argument C<$testname> is the name of the test. If it is omitted, C chooses a default test name C. =cut sub pm_file_ok { my ($file,$name) = @_; $name ||= "Compile test for $file"; my $ok = $Test->pm_file_compiles($file); $Test->ok($ok, $name); $Test->diag("$file does not compile") unless $ok; return $ok; } =item C C will okay the test if $filename compiles as a perl script. You need to give the path to the script relative to this distribution's base directory. So if you put your scripts in a 'top-level' directory called script the argument would be C