summaryrefslogtreecommitdiffstats
path: root/t/004template.t
diff options
context:
space:
mode:
authorzach%zachlipton.com <>2002-05-09 08:49:31 +0200
committerzach%zachlipton.com <>2002-05-09 08:49:31 +0200
commitccf9d404cfe99346af2f08dbbda44a3a53912b90 (patch)
treee8d3de7e241b998d8dc5498852873938632316b9 /t/004template.t
parent1d10fae35ea91b2e038cc8d3942a1860415e5dde (diff)
downloadbugzilla-ccf9d404cfe99346af2f08dbbda44a3a53912b90.tar.gz
bugzilla-ccf9d404cfe99346af2f08dbbda44a3a53912b90.tar.xz
Fix for bug 143124, Fix warning messages about *::TESTOUT and clean up
test code. Patch makes the tests much better now. r=zach x2
Diffstat (limited to 't/004template.t')
-rw-r--r--t/004template.t22
1 files changed, 17 insertions, 5 deletions
diff --git a/t/004template.t b/t/004template.t
index f9cd0fad9..f56a30140 100644
--- a/t/004template.t
+++ b/t/004template.t
@@ -26,7 +26,6 @@
#Bugzilla Test 4#
####Templates####
-use diagnostics;
use strict;
use lib 't';
@@ -41,10 +40,21 @@ use Template;
use Test::More tests => ( scalar(@Support::Templates::referenced_files)
+ scalar(@Support::Templates::actual_files) * 2);
+# Capture the TESTOUT from Test::More or Test::Builder for printing errors.
+# This will handle verbosity for us automatically.
+my $fh;
+{
+ local $^W = 0; # Don't complain about non-existent filehandles
+ if (-e \*Test::More::TESTOUT) {
+ $fh = \*Test::More::TESTOUT;
+ } elsif (-e \*Test::Builder::TESTOUT) {
+ $fh = \*Test::Builder::TESTOUT;
+ } else {
+ $fh = \*STDOUT;
+ }
+}
+
my $include_path = $Support::Templates::include_path;
-# Capture the TESTERR from Test::More for printing errors.
-# This will handle verbosity for us automatically
-*TESTOUT = \*Test::More::TESTOUT;
# Check to make sure all templates that are referenced in
# Bugzilla exist in the proper place.
@@ -86,8 +96,8 @@ foreach my $file(@Support::Templates::actual_files) {
ok(1, "$file syntax ok");
}
else {
- print TESTOUT $template->error() . "\n";
ok(0, "$file has bad syntax --ERROR");
+ print $fh $template->error() . "\n";
}
}
else {
@@ -112,3 +122,5 @@ foreach my $file(@Support::Templates::actual_files) {
}
close(TMPL);
}
+
+exit 0;