From ad268cea66c2b91538dd60fc7f945348bb24214d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 20 Nov 2010 08:07:12 +0800 Subject: tests: stream_input tests for mixed gets/read calls Some apps may do them, so make sure we do them correctly. --- test/unit/test_tee_input.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/unit/test_tee_input.rb') diff --git a/test/unit/test_tee_input.rb b/test/unit/test_tee_input.rb index e69c8f1..3766e1f 100644 --- a/test/unit/test_tee_input.rb +++ b/test/unit/test_tee_input.rb @@ -267,6 +267,14 @@ class TestTeeInput < Test::Unit::TestCase assert_equal "World", @env['HTTP_HELLO'] end + def test_gets_read_mix + r = init_request("hello\nasdfasdf") + ti = Unicorn::TeeInput.new(@rd, r) + assert_equal "hello\n", ti.gets + assert_equal "asdfasdf", ti.read(9) + assert_nil ti.read(9) + end + private def init_request(body, size = nil) -- cgit v1.2.3-24-ge0c7