diff options
author | doy <doy@tozt.net> | 2008-12-01 23:24:07 -0500 |
---|---|---|
committer | doy <doy@tozt.net> | 2008-12-01 23:24:07 -0500 |
commit | de1939e565da64f70c0b2e3f558493fd5df8701c (patch) | |
tree | d9e2ccf11ace6b35807188bd0ff2b9711101681d /t/004-exceptions.t | |
parent | 8c6449a2d99ba53b1823d333319c327ee2eb7e7d (diff) | |
download | log-dispatch-channels-de1939e565da64f70c0b2e3f558493fd5df8701c.tar.gz log-dispatch-channels-de1939e565da64f70c0b2e3f558493fd5df8701c.zip |
finish up tests
Diffstat (limited to 't/004-exceptions.t')
-rw-r--r-- | t/004-exceptions.t | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/t/004-exceptions.t b/t/004-exceptions.t new file mode 100644 index 0000000..d852fea --- /dev/null +++ b/t/004-exceptions.t @@ -0,0 +1,32 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use lib 't/lib'; +use Test::More tests => 4; +use Test::Exception; +use Log::Dispatch::Channels; +use Log::Dispatch::ToString; + +my $logger = Log::Dispatch::Channels->new; +for my $channel (1..3) { + $logger->add_channel($channel); + $logger->add(Log::Dispatch::ToString->new(name => $channel, + min_level => 'debug'), + channels => $channel); +} + +throws_ok { $logger->log_and_die(channels => 1, + level => 'debug', + message => 'log_and_die') } + qr/^log_and_die/, + "log_and_die dies with the proper message"; +is($logger->output(1)->get_string, "log_and_die", + "log_and_die logs the proper message"); + +throws_ok { $logger->log_and_croak(channels => 2, + level => 'debug', + message => 'log_and_croak') } + qr/^log_and_croak/, + "log_and_croak dies with the proper message"; +is($logger->output(2)->get_string, "log_and_croak", + "log_and_croak logs the proper message"); |