VirtualBox

source: vbox/trunk/src/libs/openssl-3.0.1/external/perl/Text-Template-1.46/t/09-error.t@ 94081

最後變更 在這個檔案從94081是 91772,由 vboxsync 提交於 3 年 前

openssl-1.1.1l: Applied and adjusted our OpenSSL changes to 1.1.1l. bugref:10126

檔案大小: 1.2 KB
 
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
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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