File Coverage

blib/lib/Poet/t/Util.pm
Criterion Covered Total %
statement 3 3 100.0
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 4 4 100.0


line stmt bran cond sub pod time code
1             package Poet::t::Util;
2             $Poet::t::Util::VERSION = '0.16';
3 1     1   795 use Test::Class::Most parent => 'Poet::Test::Class';
  1         29194  
  1         7  
4             use Poet::Tools qw(read_file);
5             use Poet::Util::Debug qw(:all);
6             use Capture::Tiny qw(capture_stderr);
7              
8             my $poet = __PACKAGE__->initialize_temp_env( conf => { layer => 'development' } );
9              
10             sub test_debug : Tests {
11             my $data = { foo => 5, bar => 6 };
12             my $expect = qr|\[d. at .* line .*\] \[\d+\] \{\n bar => 6,\n foo => 5\n\}|;
13              
14             throws_ok { dd($data) } $expect, "dd";
15             like( dh($data), $expect, "dh" );
16             like( capture_stderr { dp($data) }, $expect, "dp" );
17              
18             my $console_log = $poet->logs_path("console.log");
19             ok( !-f $console_log, "no console log" );
20             dc($data);
21             like( read_file($console_log), qr|$expect|, "dc" );
22             }
23              
24             1;