summaryrefslogtreecommitdiffstats
path: root/t/004template.t
diff options
context:
space:
mode:
Diffstat (limited to 't/004template.t')
-rw-r--r--t/004template.t29
1 files changed, 24 insertions, 5 deletions
diff --git a/t/004template.t b/t/004template.t
index 3b858c0b3..666ce5fa4 100644
--- a/t/004template.t
+++ b/t/004template.t
@@ -38,7 +38,7 @@ use CGI qw(-no_debug);
use File::Spec;
use Template;
-use Test::More tests => ( scalar(@referenced_files) + $num_actual_files );
+use Test::More tests => ( scalar(@referenced_files) + 2 * $num_actual_files );
# Capture the TESTOUT from Test::More or Test::Builder for printing errors.
# This will handle verbosity for us automatically.
@@ -60,11 +60,16 @@ my $fh;
# fall back to English if necessary.
foreach my $file (@referenced_files) {
- my $path = File::Spec->catfile($english_default_include_path, $file);
- if (-e $path) {
- ok(1, "$path exists");
+ my @path = map(File::Spec->catfile($_, $file), @include_paths);
+ push(@path, File::Spec->catfile($english_default_include_path, $file));
+ my $found;
+ foreach my $path (@path) {
+ $found = $path if -e $path;
+ }
+ if ($found) {
+ ok(1, "$file exists");
} else {
- ok(0, "$path cannot be located --ERROR");
+ ok(0, "$file cannot be located --ERROR");
}
}
@@ -118,6 +123,20 @@ foreach my $include_path (@include_paths) {
ok(0, "$path has bad syntax --ERROR");
print $fh $data . "\n";
}
+
+ # Make sure no forbidden constructs are present.
+ local $/;
+ open(FILE, '<', $path) or die "Can't open $file: $!\n";
+ $data = <FILE>;
+ close (FILE);
+
+ # Forbid single quotes to delimit URLs, see bug 926085.
+ if ($data =~ /href=\\?'/) {
+ ok(0, "$path contains blacklisted constructs: href='...'");
+ }
+ else {
+ ok(1, "$path contains no blacklisted constructs");
+ }
}
}