Skip to main content
  • Home
  • login
  • Browse the archive

    swh mirror partner logo
swh logo
SoftwareHeritage
Software
Heritage
Mirror
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • 4159a07
  • /
  • external
  • /
  • perl
  • /
  • Text-Template-1.46
  • /
  • t
  • /
  • 09-error.t
Raw File
Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge Iframe embedding
swh:1:cnt:40f9fac6cbc81328730bfe8f391deae8390507d8
directory badge Iframe embedding
swh:1:dir:1d01bfba8f6870b87d99bb3d4729d0941a61b5f3
09-error.t
#!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;

ENEA — Copyright (C), ENEA. License: GNU AGPLv3+.
Legal notes  ::  JavaScript license information ::  Web API

back to top