[Koha-patches] [PATCH] Script to test modules compile, when used with a pre-commit hook this can test before a commit

Chris Nighswonger cnighswonger at foundations.edu
Thu Nov 11 14:50:14 CET 2010


It looks like this adds a new dependency in Class::Path which causes
the test to fail if not installed. Shouldn't this be added to the list
of perl dependencies for Koha?

Kind Regards,
Chris

On Thu, Nov 11, 2010 at 2:33 AM, Chris Cormack <chrisc at catalyst.net.nz> wrote:
> ---
>  t/00-load.t |   25 +++++++++++++++++++++++++
>  1 files changed, 25 insertions(+), 0 deletions(-)
>  create mode 100644 t/00-load.t
>
> diff --git a/t/00-load.t b/t/00-load.t
> new file mode 100644
> index 0000000..6b3172c
> --- /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();
> +
> --
> 1.7.0.4
>
> _______________________________________________
> Koha-patches mailing list
> Koha-patches at lists.koha-community.org
> http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
> website : http://www.koha-community.org/
> git : http://git.koha-community.org/
> bugs : http://bugs.koha-community.org/
>


More information about the Koha-patches mailing list