Troglodyne-CGI.t 831 B

123456789101112131415161718192021222324
  1. use Test2::V0;
  2. use File::Temp;
  3. use FindBin;
  4. use Capture::Tiny qw{capture_stdout};
  5. use lib "$FindBin::Bin/lib"; # Test libraries
  6. use lib "$FindBin::Bin/../lib"; # Code under test
  7. use Troglodyne::CGI ();
  8. use Cpanel::Template ();
  9. plan 1;
  10. subtest "render_cached_or_process_template" => sub {
  11. my $tmp_obj = File::Temp->newdir();
  12. local $Troglodyne::CGI::ULC = $tmp_obj->dirname();
  13. my $input_hr = { 'template_file' => 'bogusbogus', 'print' => 1 };
  14. my $printed = capture_stdout {
  15. Troglodyne::CGI::render_cached_or_process_template( 'whostmongler', $input_hr );
  16. };
  17. my $test_str = "# [whostmongler] This is a test of Troglodyne::CGI. Please Ignore";
  18. is( $printed, $test_str, "Got the expected output when troglodyne_do_static_render invoked" );
  19. $input_hr->{'troglodyne_do_static_render'} = 1;
  20. };