From: Russ Allbery Date: Thu, 10 Jan 2013 04:20:58 +0000 (-0800) Subject: Add test for syntax, strict, and warnings X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=0ffbf44d709da783abaa0ab1dde222d0c84c6bc2;p=packages%2Fa%2Fafs-monitor.git Add test for syntax, strict, and warnings --- diff --git a/t/strict.t b/t/strict.t new file mode 100755 index 0000000..04e196a --- /dev/null +++ b/t/strict.t @@ -0,0 +1,32 @@ +#!/usr/bin/perl +# +# Test Perl code for strict, warnings, and syntax. +# +# Written by Russ Allbery +# +# The authors hereby relinquish any claim to any copyright that they may have +# in this work, whether granted under contract or by operation of law or +# international treaty, and hereby commit to the public, at large, that they +# shall not, at any time in the future, seek to enforce any copyright in this +# work against any person or entity, or prevent any person or entity from +# copying, publishing, distributing or creating derivative works of this work. + +use strict; +use warnings; + +use File::Spec; +use Test::More; + +# Skip tests if Test::Strict is not installed. +if (!eval { require Test::Strict }) { + plan skip_all => 'Test::Strict required to test Perl syntax'; + + # Suppress "only used once" warnings. + $Test::Strict::TEST_WARNINGS = 0; +} +Test::Strict->import; + +# Test everything in the distribution directory. We also want to check use +# warnings. +$Test::Strict::TEST_WARNINGS = 1; +all_perl_files_ok(glob 'check_*');