1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
use strict;
use warnings;
use Test::More
# qw(no_plan)
tests => 7;
BEGIN {
use_ok('HTML::Template');
use_ok('CGI', qw(:html3));
}
my ($template, $q, %options);
# test a simple template
$template = HTML::Template->new(
path => 'templates',
filename => 'simple.tmpl',
debug => 0
);
can_ok('HTML::Template', qw(associateCGI));
isa_ok($template, 'HTML::Template');
$q = CGI->new();
isa_ok($q, 'CGI');
$template->associateCGI($q);
%options = map { $_, 1 } keys(%{$template->{options}});
ok($options{associate}, "associate option exists in HTML::Template object");
eval { $template->associateCGI([1 .. 10]); };
like(
$@,
qr/Warning! non-CGI object was passed to HTML::Template::associateCGI/,
"non-CGI object detected as incorrectly passed to associateCGI()"
);
=head1 NAME
t/03-associate.t
=head1 OBJECTIVE
Test previously untested method C<HTML::Template::associateCGI()>.
=cut
|