From b32d1da1d760f2e193b293af6dde9da272a85e8d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 3 Sep 2009 19:25:39 -0700 Subject: add output record separator option (:ORS) This allows overriding the default of "\n". Behavior remains similar to IO#puts, the :ORS (output record separator) is appended iff the format doesn't already end with that string. --- test/test_clogger.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/test_clogger.rb') diff --git a/test/test_clogger.rb b/test/test_clogger.rb index d3e315e..71dbad8 100644 --- a/test/test_clogger.rb +++ b/test/test_clogger.rb @@ -453,4 +453,20 @@ class TestClogger < Test::Unit::TestCase assert_nothing_raised { Clogger.new(app, :logger => logger) } end + def test_clogger_no_ORS + s = '' + app = lambda { |env| [302, [ %w(a) ], []] } + cl = Clogger.new(app, :logger => s, :format => "$request", :ORS => "") + cl.call(@req) + assert_equal "GET /hello?goodbye=true HTTP/1.0", s + end + + def test_clogger_weird_ORS + s = '' + app = lambda { |env| [302, [ %w(a) ], []] } + cl = Clogger.new(app, :logger => s, :format => "<$request", :ORS => ">") + cl.call(@req) + assert_equal "", s + end + end -- cgit v1.2.3-24-ge0c7