diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-01-14 16:20:40 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-01-14 16:21:36 -0800 |
commit | 916e7f09c56ff0ab6722c4cce5e78d71ec336d48 (patch) | |
tree | f05967baca5204ee09ff2e880566a79e4eb5691d /test | |
parent | fd00bf25c8da9a04952b14bceb7e64420caf9bdb (diff) | |
download | clogger-916e7f09c56ff0ab6722c4cce5e78d71ec336d48.tar.gz |
In case some folks need to use insanely long time formats, we'll support them.
Diffstat (limited to 'test')
-rw-r--r-- | test/test_clogger.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/test/test_clogger.rb b/test/test_clogger.rb index 58d38e8..2cd895c 100644 --- a/test/test_clogger.rb +++ b/test/test_clogger.rb @@ -156,12 +156,13 @@ class TestClogger < Test::Unit::TestCase '$env{rack.url_scheme}' \ "\n") } + longest_day = Time.at(26265600).strftime('%d/%b/%Y:%H:%M:%S %z') expect = [ [ Clogger::OP_REQUEST, "REMOTE_ADDR" ], [ Clogger::OP_LITERAL, " - " ], [ Clogger::OP_REQUEST, "REMOTE_USER" ], [ Clogger::OP_LITERAL, " [" ], - [ Clogger::OP_TIME_LOCAL, '%d/%b/%Y:%H:%M:%S %z' ], + [ Clogger::OP_TIME_LOCAL, '%d/%b/%Y:%H:%M:%S %z', longest_day ], [ Clogger::OP_LITERAL, "] \"" ], [ Clogger::OP_SPECIAL, Clogger::SPECIAL_VARS[:request] ], [ Clogger::OP_LITERAL, "\" "], @@ -677,4 +678,15 @@ class TestClogger < Test::Unit::TestCase assert s[-1].to_f >= 0.100 assert s[-1].to_f <= 0.110 end + + def test_insanely_long_time_format + s = [] + app = lambda { |env| [200, [], [] ] } + fmt = '%Y' * 100 + expect = Time.now.utc.strftime(fmt) << "\n" + assert_equal 100 * 4 + 1, expect.size + cl = Clogger.new(app, :logger => s, :format => "$time_utc{#{fmt}}") + status, headers, body = cl.call(@req) + assert_equal expect, s[0] + end end |