From 31925d90c3d292d0b5f20524082b7d3dc2e08fcb Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 8 Apr 2010 14:36:36 -0700 Subject: ext: use FIX macros instead of generic NUM macros if possible They're slightly faster when we know a number is small enough to be a FIXNUM. --- test/test_clogger.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/test_clogger.rb') diff --git a/test/test_clogger.rb b/test/test_clogger.rb index 4dab3fc..42cab1c 100644 --- a/test/test_clogger.rb +++ b/test/test_clogger.rb @@ -587,6 +587,24 @@ class TestClogger < Test::Unit::TestCase assert ! cl.reentrant? end + def test_invalid_status + s = [] + body = [] + app = lambda { |env| [ env["force.status"], [ %w(a b) ], body ] } + o = { :logger => s, :format => "$status" } + cl = Clogger.new(app, o) + status, headers, body = cl.call(@req.merge("force.status" => -1)) + assert_equal -1, status + assert_equal "-\n", s.last + status, headers, body = cl.call(@req.merge("force.status" => 1000)) + assert_equal 1000, status + assert_equal "-\n", s.last + u64_max = 0xffffffffffffffff + status, headers, body = cl.call(@req.merge("force.status" => u64_max)) + assert_equal u64_max, status + assert_equal "-\n", s.last + end + # so we don't care about the portability of this test # if it doesn't leak on Linux, it won't leak anywhere else # unless your C compiler or platform is otherwise broken -- cgit v1.2.3-24-ge0c7