Update the bundled external perl module Text-Template to version 1.56
[oweals/openssl.git] / external / perl / Text-Template-1.56 / t / ofh.t
1 #!perl
2 #
3 # test apparatus for Text::Template module
4 # still incomplete.
5
6 use strict;
7 use warnings;
8 use Test::More tests => 3;
9 use File::Temp;
10
11 use_ok 'Text::Template' or exit 1;
12
13 my $template = Text::Template->new(
14     TYPE   => 'STRING',
15     SOURCE => q{My process ID is {$$}});
16
17 my $of = File::Temp->new;
18
19 my $text = $template->fill_in(OUTPUT => $of);
20
21 # (1) No $text should have been constructed.  Return value should be true.
22 is $text, '1';
23
24 close $of or die "close(): $!";
25
26 open my $ifh, '<', $of->filename or die "open($of): $!";
27
28 my $t;
29 { local $/; $t = <$ifh> }
30 close $ifh;
31
32 # (2) The text should have been printed to the file
33 is $t, "My process ID is $$";