Test modules compile
authorChris Cormack <chrisc@catalyst.net.nz>
Thu, 11 Nov 2010 08:06:00 +0000 (09:06 +0100)
committerChris Cormack <chrisc@catalyst.net.nz>
Thu, 11 Nov 2010 08:31:02 +0000 (21:31 +1300)
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 <f.demians@tamil.fr>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
t/00-load.t [new file with mode: 0644]

diff --git a/t/00-load.t b/t/00-load.t
new file mode 100644 (file)
index 0000000..6b3172c
--- /dev/null
@@ -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();
+