VirtualBox

source: vbox/trunk/src/libs/openssl-3.0.7/external/perl/Text-Template-1.56/t/error.t@ 100620

Last change on this file since 100620 was 94320, checked in by vboxsync, 3 years ago

libs/openssl-3.0.1: Export to OSE and fix copyright headers in Makefiles, bugref:10128

File size: 808 bytes
Line 
1#!perl
2#
3# test apparatus for Text::Template module
4# still incomplete.
5
6use strict;
7use warnings;
8use Test::More tests => 6;
9
10use_ok 'Text::Template' or exit 1;
11
12# (1-2) Missing source
13eval {
14 Text::Template->new();
15 pass;
16};
17
18like $@, qr/^\QUsage: Text::Template::new(TYPE => ..., SOURCE => ...)/;
19
20eval { Text::Template->new(TYPE => 'FILE'); };
21like $@, qr/^\QUsage: Text::Template::new(TYPE => ..., SOURCE => ...)/;
22
23# (3) Invalid type
24eval { Text::Template->new(TYPE => 'wlunch', SOURCE => 'fish food'); };
25like $@, qr/^\QIllegal value `WLUNCH' for TYPE parameter/;
26
27# (4-5) File does not exist
28my $o = Text::Template->new(
29 TYPE => 'file',
30 SOURCE => 'this file does not exist');
31ok !defined $o;
32
33ok defined($Text::Template::ERROR)
34 && $Text::Template::ERROR =~ /^Couldn't open file/;
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