File: 09-error.t

package info (click to toggle)
libtext-template-perl 1.20-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 152 kB
  • ctags: 21
  • sloc: perl: 954; makefile: 46
file content (51 lines) | stat: -rw-r--r-- 953 bytes parent folder | download
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
46
47
48
49
50
51
#!perl
#
# test apparatus for Text::Template module
# still incomplete.

use lib '../blib/lib';
use Text::Template;

die "This is the test program for Text::Template version 1.20.
You are using version $Text::Template::VERSION instead.
That does not make sense.\n
Aborting"
  unless $Text::Template::VERSION == 1.20;

print "1..3\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');
};
unless ($@ =~ /^\QUsage: Text::Template::new(TYPE => ..., SOURCE => ...)/) {
  print STDERR $@;
  print "not ";
}
print "ok $n\n";
$n++;

# (3) Invalid type
eval {
  Text::Template->new(TYPE => 'wlunch', SOURCE => 'fish food');
};
unless ($@ =~ /^\QIllegal value \`WLUNCH\' for TYPE parameter/) {
  print STDERR $@;
  print "not ";
}
print "ok $n\n";
$n++;

exit;