4415126ce110f93004599de86eadf4de8adb8b6e
[ZOOM-Perl-moved-to-github.git] / t / 27-logging.t
1 # $Id: 27-logging.t,v 1.2 2007-02-26 14:56:26 mike Exp $
2
3 # Before `make install' is performed this script should be runnable with
4 # `make test'. After `make install' it should work as `perl 27-logging.t'
5
6 use strict;
7 use warnings;
8 use Test::More tests => 11;
9
10 BEGIN { use_ok('ZOOM') };
11
12 check_level("none", 0);
13 check_level("none,debug", 2);
14 check_level("none,warn", 4);
15 check_level("none,warn,debug", 6);
16 check_level("none,zoom", 16384);
17 check_level("none,-warn", 0);
18 check_level("", 2077);
19 check_level("-warn", 2073);
20 check_level("zoom", 18461);
21 check_level("none,zoom,fruit", 49152);
22
23 sub check_level {
24     my($str, $expect) = @_;
25     my $level = ZOOM::Log::mask_str($str);
26     ok($level == $expect, "log-level for '$str' ($level, expected $expect)");
27 }
28
29 # See comment in "17-logging.t" on incompleteness of test-suite.
30