Update the bundled external perl module Text-Template to version 1.56
[openssl.git] / external / perl / Text-Template-1.56 / t / out.t
1 #!perl
2 #
3 # test apparatus for Text::Template module
4 # still incomplete.
5 #
6
7 use strict;
8 use warnings;
9 use Test::More tests => 4;
10
11 use_ok 'Text::Template' or exit 1;
12
13 my $templateIN = q{
14 This line should have a 3: {1+2}
15
16 This line should have several numbers:
17 { $t = ''; foreach $n (1 .. 20) { $t .= $n . ' ' } $t }
18 };
19
20 my $templateOUT = q{
21 This line should have a 3: { $OUT = 1+2 }
22
23 This line should have several numbers:
24 { foreach $n (1 .. 20) { $OUT .= $n . ' ' } }
25 };
26
27 # Build templates from string
28 my $template = Text::Template->new('type' => 'STRING', 'source' => $templateIN);
29 isa_ok $template, 'Text::Template';
30
31 $templateOUT = Text::Template->new('type' => 'STRING', 'source' => $templateOUT);
32 isa_ok $templateOUT, 'Text::Template';
33
34 # Fill in templates
35 my $text    = $template->fill_in();
36 my $textOUT = $templateOUT->fill_in();
37
38 # (1) They should be the same
39 is $text, $textOUT;
40
41 # Missing:  Test this feature in Safe compartments;
42 # it's a totally different code path.
43 # Decision: Put that into safe.t, because that file should
44 # be skipped when Safe.pm is unavailable.
45
46 exit;