diff options
Diffstat (limited to 'test/test_clogger.rb')
-rw-r--r-- | test/test_clogger.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/test_clogger.rb b/test/test_clogger.rb index 5b81125..4dc1371 100644 --- a/test/test_clogger.rb +++ b/test/test_clogger.rb @@ -410,4 +410,20 @@ class TestClogger < Test::Unit::TestCase assert_equal "GET\n", str.string end + def test_content_length_null + str = StringIO.new + app = lambda { |env| [302, [ %w(a) ], []] } + cl = Clogger.new(app, :logger => str, :format => '$content_length') + cl.call(@req) + assert_equal "-\n", str.string + end + + def test_content_length_set + str = StringIO.new + app = lambda { |env| [302, [ %w(a) ], []] } + cl = Clogger.new(app, :logger => str, :format => '$content_length') + cl.call(@req.merge('CONTENT_LENGTH' => '5')) + assert_equal "5\n", str.string + end + end |