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

Indexes created Thu Nov 07 10:32:03 CST 2024