File: TestUtil.pm

package info (click to toggle)
liblog-dispatch-perl 2.71-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 560 kB
  • sloc: perl: 1,457; sh: 24; makefile: 2
file content (49 lines) | stat: -rw-r--r-- 731 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package Log::Dispatch::TestUtil;

use strict;
use warnings;

use Data::Dumper;

use Exporter qw( import );

our @EXPORT_OK = qw(
    cmp_deeply
    dump_one_line
);

sub cmp_deeply {
    my ( $ref1, $ref2, $name ) = @_;

    my $tb = Test::Builder->new();
    $tb->is_eq( dump_one_line($ref1), dump_one_line($ref2), $name );
}

sub dump_one_line {
    my ($value) = @_;

    return Data::Dumper->new( [$value] )->Indent(0)->Sortkeys(1)
        ->Quotekeys(0)->Terse(1)->Dump();
}

1;

# ABSTRACT: Utilities used internally by Log::Dispatch for testing

__END__

=head1 METHODS

=over

=item cmp_deeply

A cheap version of Test::Deep::cmp_deeply.

=item dump_one_line

Dump a value to a single line using Data::Dumper.

=back

=cut