From 1c5938982b2b576da727a1921bb420436558fbad Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 5 Dec 2005 02:41:32 +0000 Subject: [PATCH] automatic syntax checker for all modules in lib --- t/syntaxCheck.t | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 t/syntaxCheck.t diff --git a/t/syntaxCheck.t b/t/syntaxCheck.t new file mode 100644 index 000000000..353c0a1a0 --- /dev/null +++ b/t/syntaxCheck.t @@ -0,0 +1,64 @@ +#------------------------------------------------------------------- +# WebGUI is Copyright 2001-2005 Plain Black Corporation. +#------------------------------------------------------------------- +# Please read the legal notices (docs/legal.txt) and the license +# (docs/license.txt) that came with this distribution before using +# this software. +#------------------------------------------------------------------- +# http://www.plainblack.com info@plainblack.com +#------------------------------------------------------------------- + +# ---- BEGIN DO NOT EDIT ---- +use strict; +use lib '../lib'; +use Getopt::Long; +use WebGUI::Session; +use File::Find; +# ---- END DO NOT EDIT ---- + + +use Test::More; # increment this value for each test you create +my @modules; +my $wgLib = "../lib/"; +diag("Checking modules in $wgLib"); +File::Find::find(\&getWebGUIModules, $wgLib); + +my $numTests = scalar @modules; + +plan tests => $numTests; + +diag("Planning on $numTests tests"); + +foreach my $package (@modules) { + my $returnVal = system("export PERL5LIB=$wgLib; perl -wc $package"); + is($returnVal, 0, "syntax check for $package"); +} + +initialize(); # this line is required + +# put your tests here + +cleanup(); # this line is required + +#---------------------------------------- +sub getWebGUIModules { + push(@modules,$File::Find::name) if /\.pm$/; +} + + +# ---- DO NOT EDIT BELOW THIS LINE ----- + +sub initialize { + $|=1; # disable output buffering + my $configFile; + GetOptions( + 'configFile=s'=>\$configFile + ); + exit 1 unless ($configFile); + WebGUI::Session::open("..",$configFile); +} + +sub cleanup { + WebGUI::Session::close(); +} +