Replaced the CPANPLUS::Dist::Build packed test files with their binary equivalents.
[p5sagit/p5-mst-13.2.git] / ext / Log-Message / t / 01_Log-Message-Config.t
1 ### Log::Message::Config test suite ###
2 BEGIN { 
3     if( $ENV{PERL_CORE} ) {
4         chdir '../lib/Log/Message' if -d '../lib/Log/Message';
5         unshift @INC, '../../..';
6     }
7
8
9 BEGIN { chdir 't' if -d 't' }
10
11 use strict;
12 use lib qw[../lib conf];
13 use Test::More tests => 6;
14 use File::Spec;
15 use File::Basename qw[dirname];
16
17 use_ok( 'Log::Message::Config'    ) or diag "Config.pm not found.  Dying", die;
18 use_ok( 'Log::Message'            ) or diag "Module.pm not found.  Dying", die;
19
20 {
21     my $default = {
22         private => undef,
23         verbose => 1,
24         tag     => 'NONE',
25         level   => 'log',
26         remove  => 0,
27         chrono  => 1,
28     };
29
30     my $log = Log::Message->new();
31
32     is_deeply( $default, $log->{CONFIG}, q[Config creation from default] );
33 }
34
35 {
36     my $config = {
37         private => 1,
38         verbose => 1,
39         tag     => 'TAG',
40         level   => 'carp',
41         remove  => 0,
42         chrono  => 1,
43     };
44
45     my $log = Log::Message->new( %$config );
46
47     is_deeply( $config, $log->{CONFIG}, q[Config creation from options] );
48 }
49
50 {
51     my $file = {
52         private => 1,
53         verbose => 0,
54         tag     => 'SOME TAG',
55         level   => 'carp',
56         remove  => 1,
57         chrono  => 0,
58     };
59
60     my $log = Log::Message->new(
61                     config  => File::Spec->catfile( qw|conf config_file| )
62                 );
63
64     is_deeply( $file, $log->{CONFIG}, q[Config creation from file] );
65 }
66
67 {
68
69     my $mixed = {
70         private => 1,
71         verbose => 0,
72         remove  => 1,
73         chrono  => 0,
74         tag     => 'MIXED',
75         level   => 'die',
76     };
77     my $log = Log::Message->new(
78                     config  => File::Spec->catfile( qw|conf config_file| ),
79                     tag     => 'MIXED',
80                     level   => 'die',
81                 );
82     is_deeply( $mixed, $log->{CONFIG}, q[Config creation from file & options] );
83 }
84