From 7ecf2c2dc42d443d819ed04e3a11065f2802d51a Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Thu, 11 Nov 2010 09:06:00 +0100 Subject: [PATCH] Test modules compile MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Script to test modules compile, when used with a pre-commit hook this can test before a commit Signed-off-by: Frédéric Demians Signed-off-by: Chris Cormack --- t/00-load.t | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 t/00-load.t diff --git a/t/00-load.t b/t/00-load.t new file mode 100644 index 0000000000..6b3172c2e4 --- /dev/null +++ b/t/00-load.t @@ -0,0 +1,25 @@ +# This script is called by the pre-commit git hook to test modules compile + +use strict; +use warnings; +use Test::More; +use Path::Class; +use File::Find; + +my $lib = dir('C4')->absolute->resolve; +find({ + bydepth => 1, + no_chdir => 1, + wanted => sub { + my $m = $_; + return unless $m =~ s/[.]pm$//; + return if $m =~ /Auth_with_ldap/; # Dont test this, it will fail on use + return if $m =~ /Cache/; # Cache modules are a WIP, add the tests back when we are using them more + return if $m =~ /SIP/; # SIP modules will not load clean + $m =~ s{^.*/C4/}{C4/}; + $m =~ s{/}{::}g; + use_ok($m) || BAIL_OUT("***** PROBLEMS LOADING FILE '$m'"); + }, +}, $lib); +done_testing(); + -- 2.20.1