summaryrefslogtreecommitdiff
path: root/t/070UTCDate.t
diff options
context:
space:
mode:
Diffstat (limited to 't/070UTCDate.t')
-rw-r--r--t/070UTCDate.t42
1 files changed, 42 insertions, 0 deletions
diff --git a/t/070UTCDate.t b/t/070UTCDate.t
new file mode 100644
index 0000000..4707299
--- /dev/null
+++ b/t/070UTCDate.t
@@ -0,0 +1,42 @@
+###########################################
+# Tests for Log4perl::DateFormat with gmtime
+###########################################
+
+BEGIN {
+ if($ENV{INTERNAL_DEBUG}) {
+ require Log::Log4perl::InternalDebug;
+ Log::Log4perl::InternalDebug->enable();
+ }
+}
+
+use warnings;
+use strict;
+
+use Test::More;
+
+BEGIN { plan tests => 2 }
+
+use Log::Log4perl qw(get_logger);
+use Log::Log4perl::Appender::TestBuffer;
+
+sub init_with_utc {
+ my ($utc) = @_;
+ my $conf = <<'CONF';
+log4perl.category.Bar.Twix = WARN, Buffer
+log4perl.appender.Buffer = Log::Log4perl::Appender::TestBuffer
+log4perl.appender.Buffer.layout = \
+ Log::Log4perl::Layout::PatternLayout
+log4perl.appender.Buffer.layout.ConversionPattern = %d{HH:mm:ss}%n
+CONF
+ if (defined $utc) {
+ $conf .= "log4perl.utcDateTimes = $utc\n";
+ }
+
+ Log::Log4perl::init(\$conf);
+}
+
+init_with_utc(1);
+ok $Log::Log4perl::DateFormat::GMTIME, "init_with_utc";
+
+init_with_utc(0);
+ok ! $Log::Log4perl::DateFormat::GMTIME, "init_with_utc";