update test for bug 83267 to be shippable
[p5sagit/Log-Contextual.git] / t / regression_83267.t
CommitLineData
67d7bb36 1#original bug report https://rt.cpan.org/Public/Bug/Display.html?id=83267
2
496782e0 3#The following code from Module::Metadata 1.000011 exposed the bug
67d7bb36 4#BEGIN {
5# if ($INC{'Log/Contextual.pm'}) {
6# Log::Contextual->import('log_info');
7# } else {
8# *log_info = sub (&) { warn $_[0]->() };
9# }
10#}
11
496782e0 12use Test::More qw(no_plan);
13
14BEGIN {
7b2a6f88 15 #an optional expanded test mode
496782e0 16 if (0) {
17 eval {
18 package NotMain;
19
20 use strict;
21 use warnings;
22 use Test::More;
23 use Log::Contextual::SimpleLogger;
24
25 use Log::Contextual qw(:log),
26 -default_logger => Log::Contextual::SimpleLogger->new({ levels => [qw( )] });
27
28 eval { log_info { "Yep" } };
29 is($@, '', 'Invoked log function in package other than main');
30 };
31
32 is($@, '', 'non-main package subtest did not die');
33 }
34}
35
36package main;
37
38use strict;
39use warnings;
40use Test::More;
67d7bb36 41
42#bug report does not include a case where Log::Contextual is
43#brought in via 'use'
44require Log::Contextual;
45
46#try to import a single log function but do not include any tags
47eval { Log::Contextual->import('log_info') };
496782e0 48is($@, '', 'Imported log function with out dying');
49
7b2a6f88 50#don't try to invoke the function for now
51#eval { log_info { "test" } 1 };
52#is($@, '', 'Was able to invoke log function');