06-ofh.t 835 B

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