VirtualBox

source: vbox/trunk/src/libs/openssl-1.1.1k/external/perl/Text-Template-1.46/t/09-error.t@ 90293

Last change on this file since 90293 was 90293, checked in by vboxsync, 4 years ago

openssl-1.1.1k: Applied and adjusted our OpenSSL changes to 1.1.1k. bugref:10072

File size: 1.2 KB
Line 
1#!perl
2#
3# test apparatus for Text::Template module
4# still incomplete.
5
6use Text::Template;
7
8die "This is the test program for Text::Template version 1.46.
9You are using version $Text::Template::VERSION instead.
10That does not make sense.\n
11Aborting"
12 unless $Text::Template::VERSION == 1.46;
13
14print "1..5\n";
15$n = 1;
16
17# (1-2) Missing source
18eval {
19 Text::Template->new();
20};
21unless ($@ =~ /^\QUsage: Text::Template::new(TYPE => ..., SOURCE => ...)/) {
22 print STDERR $@;
23 print "not ";
24}
25print "ok $n\n";
26$n++;
27
28eval {
29 Text::Template->new(TYPE => 'FILE');
30};
31if ($@ =~ /^\QUsage: Text::Template::new(TYPE => ..., SOURCE => ...)/) {
32 print "ok $n\n";
33} else {
34 print STDERR $@;
35 print "not ok $n\n";
36}
37$n++;
38
39# (3) Invalid type
40eval {
41 Text::Template->new(TYPE => 'wlunch', SOURCE => 'fish food');
42};
43if ($@ =~ /^\QIllegal value `WLUNCH' for TYPE parameter/) {
44 print "ok $n\n";
45} else {
46 print STDERR $@;
47 print "not ok $n\n";
48}
49$n++;
50
51# (4-5) File does not exist
52my $o = Text::Template->new(TYPE => 'file',
53 SOURCE => 'this file does not exist');
54print $o ? "not ok $n\n" : "ok $n\n";
55$n++;
56print defined($Text::Template::ERROR)
57 && $Text::Template::ERROR =~ /^Couldn't open file/
58 ? "ok $n\n" : "not ok $n\n";
59$n++;
60
61
62exit;
63
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette