about summary refs log tree commit homepage
path: root/test/test_clogger.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-09-03 19:25:39 -0700
committerEric Wong <normalperson@yhbt.net>2009-09-03 21:04:31 -0700
commitb32d1da1d760f2e193b293af6dde9da272a85e8d (patch)
tree3bc5627bf6ddd4df796a6164ad510127f4b62dfc /test/test_clogger.rb
parentaf12d387069d017494daa23534fa7f87aea9ff3b (diff)
downloadclogger-b32d1da1d760f2e193b293af6dde9da272a85e8d.tar.gz
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.
Diffstat (limited to 'test/test_clogger.rb')
-rw-r--r--test/test_clogger.rb16
1 files changed, 16 insertions, 0 deletions
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 "<GET /hello?goodbye=true HTTP/1.0>", s
+  end
+
 end