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