From 7067afe8a96580b6b3e2f00afbab701d095a11f1 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Mon, 22 Feb 2010 10:21:07 -0600 Subject: [PATCH] fix syntax error, add basic tests --- lib/WebGUI/Paths.pm | 2 +- t/Paths.t | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 t/Paths.t diff --git a/lib/WebGUI/Paths.pm b/lib/WebGUI/Paths.pm index 22f852671..c158f347a 100644 --- a/lib/WebGUI/Paths.pm +++ b/lib/WebGUI/Paths.pm @@ -76,7 +76,7 @@ sub preloadPaths { my @paths; try { @paths = grep { - -d ? 1 : do { + (-d) ? 1 : do { warn "WARNING: Not adding lib directory '$path' from @{[PRELOAD_CUSTOM]}: Directory does not exist.\n"; 0; } diff --git a/t/Paths.t b/t/Paths.t new file mode 100644 index 000000000..5e1d8eb04 --- /dev/null +++ b/t/Paths.t @@ -0,0 +1,15 @@ +use 5.010; +use strict; +use warnings; + +use Test::More tests => 2; # last test to print +use WebGUI::Paths; + +can_ok 'WebGUI::Paths', qw(CONFIG_BASE LOG_CONFIG SPECTRE_CONFIG UPGRADES_PATH PRELOAD_CUSTOM PRELOAD_EXCLUSIONS EXTRAS DEFAULT_UPLOADS DEFAULT_SQL); +ok !(grep { WebGUI::Paths->can($_) } + qw(croak realpath catdir splitpath catpath splitpath updir catfile try catch _readTextLines)), + 'Internal functions cleaned up'; + +my @configs = WebGUI::Paths->siteConfigs; +ok !(\@configs ~~ WebGUI::Paths->SPECTRE_CONFIG), 'Spectre config not listed in configs'; +