summaryrefslogtreecommitdiff
path: root/t/060Initialized.t
diff options
context:
space:
mode:
Diffstat (limited to 't/060Initialized.t')
-rw-r--r--t/060Initialized.t44
1 files changed, 44 insertions, 0 deletions
diff --git a/t/060Initialized.t b/t/060Initialized.t
new file mode 100644
index 0000000..5a13e5e
--- /dev/null
+++ b/t/060Initialized.t
@@ -0,0 +1,44 @@
+BEGIN {
+ if($ENV{INTERNAL_DEBUG}) {
+ require Log::Log4perl::InternalDebug;
+ Log::Log4perl::InternalDebug->enable();
+ }
+}
+
+use warnings;
+use strict;
+
+use Test::More tests => 3;
+
+use Log::Log4perl;
+use Log::Log4perl::Appender::TestBuffer;
+
+eval {
+ Log::Log4perl->init('nonexistant_file');
+};
+
+ok((not Log::Log4perl->initialized()), 'Failed init doesn\'t flag initialized');
+
+Log::Log4perl->reset();
+
+eval {
+ Log::Log4perl->init_once('nonexistant_file');
+};
+
+ok((not Log::Log4perl->initialized()), 'Failed init_once doesn\'t flag '
+ .'initialized');
+
+Log::Log4perl->reset();
+
+eval {
+ Log::Log4perl->init(\ <<EOT);
+log4j.rootLogger=DEBUG, A1
+log4j.appender.A1=Log::Log4perl::Appender::TestBuffer
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c - %m%n
+EOT
+};
+
+ok(Log::Log4perl->initialized(), 'init flags initialized');
+
+1; # End of 060Initialized.t