root/Log-Dispatch-Config/trunk/t/11_no_watch.t

Revision 460 (checked in by miyagawa, 18 years ago)

add

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 use strict;
2 use Test::More tests => 3;
3
4 use Log::Dispatch::Config;
5 use FileHandle;
6 use File::Temp qw(tempfile);
7 use IO::Scalar;
8
9 sub writefile {
10     my $fh = FileHandle->new(">" . shift) or die $!;
11     $fh->print(@_);
12 }
13
14 my($fh, $file) = tempfile;
15 writefile($file, <<'CFG');
16 dispatchers=foo
17 foo.class=Log::Dispatch::File
18 foo.filename=/dev/null
19 foo.min_level=debug
20 CFG
21     ;
22
23 Log::Dispatch::Config->configure($file);
24
25 {
26     my $disp = Log::Dispatch::Config->instance;
27     isa_ok $disp->{outputs}->{foo}, 'Log::Dispatch::File';
28
29     sleep 1;
30
31     writefile($file, <<'CFG');
32 dispatchers=bar
33 bar.class=Log::Dispatch::File
34 bar.filename=/dev/null
35 bar.min_level=debug
36 CFG
37     ;
38
39     local $^W;
40     my $disp2 = Log::Dispatch::Config->instance;
41     isa_ok $disp2->{outputs}->{foo}, 'Log::Dispatch::File';
42     is "$disp", "$disp2", "same: $disp - $disp2";
43 }
Note: See TracBrowser for help on using the browser.