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

  • c6699af
  • /
  • external
  • /
  • perl
  • /
  • Text-Template-1.56
  • /
  • t
  • /
  • 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:4f024db12378391d545475cc8a6b7f2d3b27b0aa
directory badge Iframe embedding
swh:1:dir:7f3413dd469356106299d911badbf763182377dc
error.t
#!perl
#
# test apparatus for Text::Template module
# still incomplete.

use strict;
use warnings;
use Test::More tests => 6;

use_ok 'Text::Template' or exit 1;

# (1-2) Missing source
eval {
    Text::Template->new();
    pass;
};

like $@, qr/^\QUsage: Text::Template::new(TYPE => ..., SOURCE => ...)/;

eval { Text::Template->new(TYPE => 'FILE'); };
like $@, qr/^\QUsage: Text::Template::new(TYPE => ..., SOURCE => ...)/;

# (3) Invalid type
eval { Text::Template->new(TYPE => 'wlunch', SOURCE => 'fish food'); };
like $@, qr/^\QIllegal value `WLUNCH' for TYPE parameter/;

# (4-5) File does not exist
my $o = Text::Template->new(
    TYPE   => 'file',
    SOURCE => 'this file does not exist');
ok !defined $o;

ok defined($Text::Template::ERROR)
    && $Text::Template::ERROR =~ /^Couldn't open file/;

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

back to top