7 use Test
::More tests
=> 7;
11 use_ok
( 'CXGN::Debug' )
12 or BAIL_OUT
('could not include the module being tested');
16 my $conf_debug = CXGN
::Config
->load->{'debug'};
19 local $ENV{CXGN_DEBUG
} = 1;
20 my $d = CXGN
::Debug
->new;
22 $d->debug('this is a test debug message');
23 } qr/this is a test debug message/, 'debug() emits when CXGN_DEBUG is set to 1';
25 $d->d('this is a test debug message');
26 } qr/this is a test debug message/, 'same thing with d()';
30 # NOTE: since currently there is no programmatic way to alter the
31 # VHost conf vars at runtime, have to settle for less-than complete
32 # testing of CXGN::Debug's response to the debug conf variable
35 skip
'debug conf var is set, cannot test silence of Debug in absence of either set variable', 2
38 local $ENV{CXGN_DEBUG
};
39 delete $ENV{CXGN_DEBUG
};
41 my $d = CXGN
::Debug
->new;
43 $d->debug('this is a test debug message');
44 } undef, "debug() does not emit when both conf debug and CXGN_DEBUG env var are false";
46 $d->d('this is a test debug message');
47 } undef, 'same thing with d()';
52 local $ENV{CXGN_DEBUG
} = 0;
53 my $d = CXGN
::Debug
->new;
55 $d->debug('this is a test debug message');
56 } undef, "debug() does not emit when CXGN_DEBUG is set to 0";
58 $d->d('this is a test debug message');
59 } undef, 'same thing with d()';