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