diff options
Diffstat (limited to 'test/unit/test_chunked_reader.rb')
-rw-r--r-- | test/unit/test_chunked_reader.rb | 59 |
1 files changed, 1 insertions, 58 deletions
diff --git a/test/unit/test_chunked_reader.rb b/test/unit/test_chunked_reader.rb index 6aaa72a..a1323e9 100644 --- a/test/unit/test_chunked_reader.rb +++ b/test/unit/test_chunked_reader.rb @@ -53,63 +53,6 @@ class TestChunkedReader < Test::Unit::TestCase assert_raises(EOFError) { cr.readpartial(8192) } end - def test_gets1 - cr = bin_reader("4\r\nasdf\r\n0\r\n") - STDOUT.sync = true - assert_equal 'asdf', cr.gets - assert_raises(EOFError) { cr.readpartial(8192) } - end - - def test_gets2 - cr = bin_reader("4\r\nasd\n\r\n0\r\n\r\n") - assert_equal "asd\n", cr.gets - assert_nil cr.gets - end - - def test_gets3 - max = Unicorn::Const::CHUNK_SIZE * 2 - str = ('a' * max).freeze - first = 5 - last = str.size - first - cr = bin_reader( - "#{'%x' % first}\r\n#{str[0, first]}\r\n" \ - "#{'%x' % last}\r\n#{str[-last, last]}\r\n" \ - "0\r\n") - assert_equal str, cr.gets - assert_nil cr.gets - end - - def test_readpartial_gets_mixed1 - max = Unicorn::Const::CHUNK_SIZE * 2 - str = ('a' * max).freeze - first = 5 - last = str.size - first - cr = bin_reader( - "#{'%x' % first}\r\n#{str[0, first]}\r\n" \ - "#{'%x' % last}\r\n#{str[-last, last]}\r\n" \ - "0\r\n") - partial = cr.readpartial(16384) - assert String === partial - - len = max - partial.size - assert_equal(str[-len, len], cr.gets) - assert_raises(EOFError) { cr.readpartial(1) } - assert_nil cr.gets - end - - def test_gets_mixed_readpartial - max = 10 - str = ("z\n" * max).freeze - first = 5 - last = str.size - first - cr = bin_reader( - "#{'%x' % first}\r\n#{str[0, first]}\r\n" \ - "#{'%x' % last}\r\n#{str[-last, last]}\r\n" \ - "0\r\n") - assert_equal("z\n", cr.gets) - assert_equal("z\n", cr.gets) - end - def test_dd cr = bin_reader("6\r\nhello\n\r\n") tmp = Tempfile.new('test_dd') @@ -138,7 +81,7 @@ class TestChunkedReader < Test::Unit::TestCase exit 0 end while true } - assert_equal "hello\n", cr.gets + assert_equal "hello\n", cr.readpartial(6) sha1 = Digest::SHA1.new buf = Unicorn::Z.dup begin |