• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!perl
2#
3# test apparatus for Text::Template module
4# still incomplete.
5
6use Text::Template;
7
8die "This is the test program for Text::Template version 1.46.
9You are using version $Text::Template::VERSION instead.
10That does not make sense.\n
11Aborting"
12  unless $Text::Template::VERSION == 1.46;
13
14print "1..2\n";
15
16$n=1;
17
18$template = new Text::Template TYPE => STRING, SOURCE => q{My process ID is {$$}};
19$of = "t$$";
20END { unlink $of }
21open O, "> $of" or die;
22
23$text = $template->fill_in(OUTPUT => \*O);
24
25# (1) No $text should have been constructed.  Return value should be true.
26print +($text eq '1' ? '' : 'not '), "ok $n\n";
27$n++;
28
29close O or die;
30open I, "< $of" or die;
31{ local $/; $t = <I> }
32close I;
33
34# (2) The text should have been printed to the file
35print +($t eq "My process ID is $$" ? '' : 'not '), "ok $n\n";
36$n++;
37
38exit;
39
40