kivitendo/t/004template.t @ f1fc6f27
1d91e75c | Sven Schöling | # -*- Mode: perl; indent-tabs-mode: nil -*-
|
||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code are the Bugzilla tests.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Jacob Steenhagen.
|
||||
# Portions created by Jacob Steenhagen are
|
||||
# Copyright (C) 2001 Jacob Steenhagen. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Jacob Steenhagen <jake@bugzilla.org>
|
||||
# Zach Lipton <zach@zachlipton.com>
|
||||
# David D. Kilzer <ddkilzer@kilzer.net>
|
||||
# Tobias Burnus <burnus@net-b.de>
|
||||
#
|
||||
#################
|
||||
#Bugzilla Test 4#
|
||||
####Templates####
|
||||
use strict;
|
||||
use lib 't';
|
||||
use Support::Templates;
|
||||
use File::Spec;
|
||||
f1a3e8eb | Sven Schöling | use File::Slurp;
|
||
1d91e75c | Sven Schöling | use Template;
|
||
f1a3e8eb | Sven Schöling | use Test::More tests => ( scalar(@referenced_files));
|
||
my $template_path = 'templates/webpages/';
|
||||
1d91e75c | Sven Schöling | |||
# 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;
|
||||
}
|
||||
}
|
||||
f1a3e8eb | Sven Schöling | # test master files for <translate> tag
|
||
foreach my $ref (@Support::Templates::referenced_files) {
|
||||
0623a45d | Sven Schöling | my $file = "${template_path}${ref}.html";
|
||
f1a3e8eb | Sven Schöling | my $data = read_file($file) || die "??? couldn't open $file";
|
||
if ($data =~ /<translate>/) {
|
||||
ok(0, "$file uses deprecated <translate> tags.");
|
||||
} else {
|
||||
ok(1, "$file does not use <translate> tags.");
|
||||
1d91e75c | Sven Schöling | }
|
||
}
|
||||
exit 0;
|