File Coverage

File:t/12-debug.t
Coverage:95.3%

linestmtbrancondsubpodtimecode
1#!/usr/bin/env perl
2
3
1
1
1
3312
2
28
use strict;
4
1
1
1
4
0
37
use warnings;
5
1
1
1
410
79017
6
use Test::More;
6
1
1
1
493
2587
2
use Test::Exception;
7
1
1
1
507
2
1203
use Util::H2O::More qw/ddd dddie/;
8
9{
10
1
2
    my $stderr = q{};
11
12    {
13
1
1
0
2
        local *STDERR;
14
1
9
        open STDERR, q{>}, \$stderr or die qq{Could not redirect STDERR: $!};
15
1
5
        ddd( { foo => q{bar} }, [ 1, 2, 3 ] );
16    }
17
18
1
47
    like $stderr, qr/foo/, q{ddd dumps a HASH reference to STDERR};
19
1
252
    like $stderr, qr/bar/, q{ddd dump contains the HASH value};
20
1
187
    like $stderr, qr/1.*2.*3/s, q{ddd dumps each supplied reference};
21}
22
23{
24
1
1
1
62348
181
1
    my $stderr = q{};
25
26    throws_ok {
27
1
25
        local *STDERR;
28
1
7
        open STDERR, q{>}, \$stderr or die qq{Could not redirect STDERR: $!};
29
1
3
        dddie( { foo => q{bar} } );
30    }
31
1
6
    qr/^died due to use of dddie/,
32    q{dddie dies with its documented fatal message after dumping its arguments};
33
34
1
210
    like $stderr, qr/foo/, q{dddie dumps its argument to STDERR before dying};
35
1
187
    like $stderr, qr/bar/, q{dddie dump contains the expected value};
36}
37
38
1
179
done_testing;