VirtualBox

source: vbox/trunk/src/libs/openssl-3.1.2/external/perl/Text-Template-1.56/t/warnings.t@ 101021

Last change on this file since 101021 was 101021, checked in by vboxsync, 15 months ago

openssl-3.1.2: Applied and adjusted our OpenSSL changes to 3.1.0. bugref:10519

File size: 1.3 KB
Line 
1#!perl
2
3use strict;
4use warnings;
5use Text::Template;
6
7# Minimum Test::More version; 0.94+ is required for `done_testing`
8BEGIN {
9 unless (eval { require Test::More; "$Test::More::VERSION" >= 0.94; }) {
10 Test::More::plan(skip_all => '[ Test::More v0.94+ ] is required for testing');
11 }
12
13 Test::More->import;
14
15 # Non-CORE module(s)
16 unless (eval { require Test::Warnings; 1; }) {
17 plan(skip_all => '[ Test::Warnings ] is required for testing');
18 }
19
20 Test::Warnings->import;
21}
22
23my $template = <<'EOT';
24{{
25if ($good =~ /good/) {
26 'This template should not produce warnings.'.$bad;
27}
28}}
29EOT
30
31$template = Text::Template->new(type => 'STRING', source => $template);
32isa_ok $template, 'Text::Template';
33
34my $result = $template->fill_in(HASH => { good => 'good' });
35
36$result =~ s/(?:^\s+)|(?:\s+$)//gs;
37is $result, 'This template should not produce warnings.';
38
39# see https://github.com/mschout/perl-text-template/issues/10
40$template = Text::Template->new(type => 'STRING', package => 'MY', source => '');
41$template->fill_in(package => 'MY', hash => { include => sub { 'XX' } });
42
43$template = Text::Template->new(type => 'STRING', package => 'MY', source => '');
44$template->fill_in(package => 'MY', hash => { include => sub { 'XX' } });
45
46done_testing;
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