File Coverage

lib/Template/Plugin/TwoStage/Test.pm
Criterion Covered Total %
statement 24 24 100.0
branch 3 4 75.0
condition n/a
subroutine 7 7 100.0
pod 2 2 100.0
total 36 37 97.3


line stmt bran cond sub pod time code
1             #
2             # This file is part of Template-Plugin-TwoStage
3             #
4             # This software is copyright (c) 2014 by Alexander Kühne.
5             #
6             # This is free software; you can redistribute it and/or modify it under
7             # the same terms as the Perl 5 programming language system itself.
8             #
9             package # hide from pause
10             Template::Plugin::TwoStage::Test;
11             # ABSTRACT: derived class for self-tests only
12              
13 4     4   144798 use strict;
  4         8  
  4         140  
14 4     4   21 use warnings;
  4         7  
  4         246  
15 4     4   25 use base qw( Template::Plugin::TwoStage );
  4         7  
  4         1902  
16 4     4   3506 use File::Temp 'tempdir';
  4         79607  
  4         273  
17 4     4   30 use Cwd ();
  4         7  
  4         630  
18              
19             Template::Plugin::TwoStage->caching_dir( tempdir( "TT_P_TwoStage_XXXXXX", TMPDIR => 1, CLEANUP => 1 ) );
20             __PACKAGE__->caching_dir( tempdir( "TT_P_TwoStage_XXXXXX", TMPDIR => 1, CLEANUP => 1 ) );
21              
22              
23             sub read_test_file {
24 3     3 1 710 my ( $class, $test_file ) = @_;
25 3         16 local $/;
26 3 50       9240 open( my $fh, "<", Template::Plugin::TwoStage::_concat_path( Cwd::cwd(), [ 't', $test_file ] ) ) or die $!;
27 3         242 my $tests = <$fh>;
28 3         31 close $fh;
29 3         161 $tests;
30             }
31              
32              
33             sub tt_config {
34 5     5 1 21503 my ( $class, $config ) = @_;
35              
36             return(
37             { INCLUDE_PATH => [ Template::Plugin::TwoStage::_concat_path( Cwd::cwd(), [ 't', 'tt' ] ) ],
38             POST_CHOMP => 1,
39             PLUGIN_BASE => 'Template::Plugin',
40             EVAL_PERL => 1,
41 5 100       17113 ( defined $config ? %{$config} : () )
  3         133  
42             }
43             );
44             }
45              
46              
47             1;
48              
49             __END__