openssl/external/perl/Text-Template-1.46/t/09-error.t
Richard Levitte 8ff2af5483 Bundle the non core Perl module Text::Template
Because we're using Text::Template and we know it's a non core Perl
module, we choose to bundle it into our source, for convenience.

external/perl/Downloaded.txt document what modules we choose to bundle
this way and exactly where we downloaded it from.

With this changes comes the transfer module for with_fallback.

Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-01-22 23:12:22 +01:00

63 lines
1.2 KiB
Perl

#!perl
#
# test apparatus for Text::Template module
# still incomplete.
use Text::Template;
die "This is the test program for Text::Template version 1.46.
You are using version $Text::Template::VERSION instead.
That does not make sense.\n
Aborting"
unless $Text::Template::VERSION == 1.46;
print "1..5\n";
$n = 1;
# (1-2) Missing source
eval {
Text::Template->new();
};
unless ($@ =~ /^\QUsage: Text::Template::new(TYPE => ..., SOURCE => ...)/) {
print STDERR $@;
print "not ";
}
print "ok $n\n";
$n++;
eval {
Text::Template->new(TYPE => 'FILE');
};
if ($@ =~ /^\QUsage: Text::Template::new(TYPE => ..., SOURCE => ...)/) {
print "ok $n\n";
} else {
print STDERR $@;
print "not ok $n\n";
}
$n++;
# (3) Invalid type
eval {
Text::Template->new(TYPE => 'wlunch', SOURCE => 'fish food');
};
if ($@ =~ /^\QIllegal value `WLUNCH' for TYPE parameter/) {
print "ok $n\n";
} else {
print STDERR $@;
print "not ok $n\n";
}
$n++;
# (4-5) File does not exist
my $o = Text::Template->new(TYPE => 'file',
SOURCE => 'this file does not exist');
print $o ? "not ok $n\n" : "ok $n\n";
$n++;
print defined($Text::Template::ERROR)
&& $Text::Template::ERROR =~ /^Couldn't open file/
? "ok $n\n" : "not ok $n\n";
$n++;
exit;