diff options
author | Richard Levitte <levitte@openssl.org> | 2019-09-09 12:49:15 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2019-09-12 12:53:32 +0200 |
commit | 05c9c7b02d3e4e66fc0c0446af1116bd5b19f6dc (patch) | |
tree | 8672ddf47c4840a1b4ec1481074bd8f3f77af51f /external/perl/Text-Template-1.56/t/broken.t | |
parent | 7f4a2dff12f93791e96a284454bdd84a2fa7d29b (diff) |
Update the bundled external perl module Text-Template to version 1.56
Fixes #9287
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9828)
Diffstat (limited to 'external/perl/Text-Template-1.56/t/broken.t')
-rwxr-xr-x | external/perl/Text-Template-1.56/t/broken.t | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/external/perl/Text-Template-1.56/t/broken.t b/external/perl/Text-Template-1.56/t/broken.t new file mode 100755 index 0000000000..40e7b74650 --- /dev/null +++ b/external/perl/Text-Template-1.56/t/broken.t @@ -0,0 +1,66 @@ +#!perl +# test apparatus for Text::Template module + +use strict; +use warnings; +use Test::More tests => 7; + +use_ok 'Text::Template' or exit 1; + +# (1) basic error delivery +{ + my $r = Text::Template->new( + TYPE => 'string', + SOURCE => '{1/0}',)->fill_in(); + is $r, q{Program fragment delivered error ``Illegal division by zero at template line 1.''}; +} + +# (2) BROKEN sub called in ->new? +{ + my $r = Text::Template->new( + TYPE => 'string', + SOURCE => '{1/0}', + BROKEN => sub { '---' },)->fill_in(); + is $r, q{---}; +} + +# (3) BROKEN sub called in ->fill_in? +{ + my $r = Text::Template->new( + TYPE => 'string', + SOURCE => '{1/0}',)->fill_in(BROKEN => sub { '---' }); + is $r, q{---}; +} + +# (4) BROKEN sub passed correct args when called in ->new? +{ + my $r = Text::Template->new( + TYPE => 'string', + SOURCE => '{1/0}', + BROKEN => sub { + my %a = @_; + qq{$a{lineno},$a{error},$a{text}}; + },)->fill_in(); + is $r, qq{1,Illegal division by zero at template line 1.\n,1/0}; +} + +# (5) BROKEN sub passed correct args when called in ->fill_in? +{ + my $r = Text::Template->new( + TYPE => 'string', + SOURCE => '{1/0}', + )->fill_in( + BROKEN => sub { + my %a = @_; + qq{$a{lineno},$a{error},$a{text}}; + }); + is $r, qq{1,Illegal division by zero at template line 1.\n,1/0}; +} + +# BROKEN sub handles undef +{ + my $r = Text::Template->new(TYPE => 'string', SOURCE => 'abc{1/0}defg') + ->fill_in(BROKEN => sub { undef }); + + is $r, 'abc'; +} |