xref: /freebsd-src/crypto/openssl/external/perl/Text-Template-1.56/t/rt29928.t (revision e0c4386e7e71d93b0edc0c8fa156263fc4a8b0b6)
1*e0c4386eSCy Schubert#!perl
2*e0c4386eSCy Schubert#
3*e0c4386eSCy Schubert# Test for RT Bug 29928 fix
4*e0c4386eSCy Schubert# https://rt.cpan.org/Public/Bug/Display.html?id=29928
5*e0c4386eSCy Schubert
6*e0c4386eSCy Schubertuse strict;
7*e0c4386eSCy Schubertuse warnings;
8*e0c4386eSCy Schubertuse Test::More tests => 2;
9*e0c4386eSCy Schubert
10*e0c4386eSCy Schubertuse_ok 'Text::Template::Preprocess' or exit 1;
11*e0c4386eSCy Schubert
12*e0c4386eSCy Schubertmy $tin = q{The value of $foo is: {$foo}.};
13*e0c4386eSCy Schubert
14*e0c4386eSCy Schubertsub tester {
15*e0c4386eSCy Schubert    1;    # dummy preprocessor to cause the bug described.
16*e0c4386eSCy Schubert}
17*e0c4386eSCy Schubert
18*e0c4386eSCy Schubertmy $tmpl1 = Text::Template::Preprocess->new(TYPE => 'STRING', SOURCE => $tin);
19*e0c4386eSCy Schubert
20*e0c4386eSCy Schubert$tmpl1->compile;
21*e0c4386eSCy Schubert
22*e0c4386eSCy Schubertmy $t1 = $tmpl1->fill_in(
23*e0c4386eSCy Schubert    HASH         => { foo => 'things' },
24*e0c4386eSCy Schubert    PREPROCESSOR => \&tester);
25*e0c4386eSCy Schubert
26*e0c4386eSCy Schubertis $t1, 'The value of $foo is: things.';
27