diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-04-16 02:03:34 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-04-16 02:06:36 +0000 |
commit | 8303d477a13a63e6b28666e04b0c62886feae48e (patch) | |
tree | fde9b917db48cad4dcd127cdf0fdce528348be53 /test/test_clogger.rb | |
parent | a84b132f51bd011f3c3441c28d23ff9c1029a9f8 (diff) | |
download | clogger-8303d477a13a63e6b28666e04b0c62886feae48e.tar.gz |
This appeared in nginx 0.9.6
Diffstat (limited to 'test/test_clogger.rb')
-rw-r--r-- | test/test_clogger.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/test_clogger.rb b/test/test_clogger.rb index 06942c4..1a555ba 100644 --- a/test/test_clogger.rb +++ b/test/test_clogger.rb @@ -1,6 +1,7 @@ # -*- encoding: binary -*- $stderr.sync = $stdout.sync = true require "test/unit" +require "time" require "date" require "stringio" require "tempfile" @@ -703,6 +704,41 @@ class TestClogger < Test::Unit::TestCase assert %r!\A\d+/\w+/\d{4}:\d\d:\d\d:\d\d \+0000\n\z! =~ s[0], s.inspect end + def test_time_iso8601 + s = [] + app = lambda { |env| [200, [], [] ] } + cl = Clogger.new(app, :logger => s, :format => "$time_iso8601") + status, headers, body = cl.call(@req) + t = Time.parse(s[0]) + assert_equal t.iso8601, s[0].strip + end + + def test_time_iso8601_pst8pdt + orig = ENV["TZ"] + ENV["TZ"] = "PST8PDT" + s = [] + app = lambda { |env| [200, [], [] ] } + cl = Clogger.new(app, :logger => s, :format => "$time_iso8601") + status, headers, body = cl.call(@req) + t = Time.parse(s[0]) + assert_equal t.iso8601, s[0].strip + ensure + ENV["TZ"] = orig + end + + def test_time_iso8601_utc + orig = ENV["TZ"] + ENV["TZ"] = "UTC" + s = [] + app = lambda { |env| [200, [], [] ] } + cl = Clogger.new(app, :logger => s, :format => "$time_iso8601") + status, headers, body = cl.call(@req) + t = Time.parse(s[0]) + assert_equal t.iso8601, s[0].strip + ensure + ENV["TZ"] = orig + end + def test_method_missing s = [] body = [] |