Bug 8383: Add test to check that Perl scripts compile
authorJared Camins-Esakov <jcamins@cpbibliography.com>
Mon, 9 Jul 2012 02:06:28 +0000 (22:06 -0400)
committerPaul Poulain <paul.poulain@biblibre.com>
Tue, 10 Jul 2012 09:13:40 +0000 (11:13 +0200)
This patch adds t/db_dependent/00-strict.pl which tests that all Perl
scripts compile. I chose to use Test::Strict so that in the future we
can also have the test check that "use strict" and "use warnings" are
enabled.

To test:
1. Run t/db_dependent/00-strict.pl.
2. Run around waving your arms in the air that we have a couple of
   scripts that don't compile.
3. Actually, that's about it. You could test my patch for bug 8384 next.

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Moved test to t/db_dependent

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>

C4/Installer/PerlDependencies.pm
debian/control
t/db_dependent/00-strict.t [new file with mode: 0644]

index 2391b0b..cc10c9a 100644 (file)
@@ -573,6 +573,10 @@ our $PERL_DEPS = {
         'usage'    => 'Core',
         'required' => '0',
         'min_ver'  => '0.05',
+    },
+    'Test::Strict' => {
+        'usage'    => 'Core',
+        'required' => '0.14',
     }
 };
 
index 588c641..334b63a 100644 (file)
@@ -68,6 +68,7 @@ Build-Depends: libcgi-session-driver-memcached-perl,
  libsms-send-perl,
  libtemplate-perl,
  libtest-simple-perl | perl-modules,
+ libtest-strict-perl,
  libtext-csv-encoded-perl,
  libtext-csv-perl,
  libtext-csv-xs-perl,
diff --git a/t/db_dependent/00-strict.t b/t/db_dependent/00-strict.t
new file mode 100644 (file)
index 0000000..7869591
--- /dev/null
@@ -0,0 +1,24 @@
+# This script is called by the pre-commit git hook to test modules compile
+
+use strict;
+use warnings;
+use Test::More;
+use Test::Strict;
+use File::Spec;
+use File::Find;
+use lib("misc/translator");
+use lib("installer");
+
+my @dirs = ( 'acqui', 'admin', 'authorities', 'basket',
+    'catalogue', 'cataloguing', 'changelanguage.pl', 'circ', 'debian', 'docs',
+    'edithelp.pl', 'errors', 'fix-perl-path.PL', 'help.pl', 'installer',
+    'koha_perl_deps.pl', 'kohaversion.pl', 'labels',
+    'mainpage.pl', 'Makefile.PL', 'members', 'misc', 'offline_circ', 'opac',
+    'patroncards', 'reports', 'reserve', 'resetversion.pl', 'reviews',
+    'rewrite-config.PL', 'rotating_collections', 'serials', 'services', 'skel',
+    'sms', 'suggestion', 'svc', 'tags', 'tools', 'virtualshelves' );
+
+$Test::Strict::TEST_STRICT = 0;
+$Test::Strict::TEST_SKIP = [ 'misc/kohalib.pl', 'sms/sms_listen_windows_start.pl' ];
+
+all_perl_files_ok(@dirs);