diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-06-30 14:15:57 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-06-30 14:15:57 -0700 |
commit | 2d3f12f0ca25ddfdec5b7d92f76489dcc1f26cf7 (patch) | |
tree | fb4229b195bbd4241b0708da3edaa894b5ca6600 /test | |
parent | 608e6243a2b15bfc28c3524ed45d5fc7598e8565 (diff) | |
download | unicorn-2d3f12f0ca25ddfdec5b7d92f76489dcc1f26cf7.tar.gz |
I'd honestly be more comfortable doing this in C (and possibly adapting the code from the libcurl internals since that code has been very well-tested).
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/test_chunked_reader.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/unit/test_chunked_reader.rb b/test/unit/test_chunked_reader.rb index ec5c68a..6a26c8f 100644 --- a/test/unit/test_chunked_reader.rb +++ b/test/unit/test_chunked_reader.rb @@ -1,5 +1,6 @@ require 'test/unit' require 'unicorn' +require 'unicorn/http11' require 'tempfile' require 'io/nonblock' require 'digest/sha1' @@ -18,6 +19,21 @@ class TestChunkedReader < Test::Unit::TestCase return if $$ != @start_pid @rd.close rescue nil @wr.close rescue nil + begin + Process.wait + rescue Errno::ECHILD + break + end while true + end + + def test_error + cr = bin_reader(@rd, "8\r\nasdfasdf\r\n8\r\nasdfasdfa#{'a' * 1024}") + a = nil + assert_nothing_raised { a = cr.readpartial(8192) } + assert_equal 'asdfasdf', a + assert_nothing_raised { a = cr.readpartial(8192) } + assert_equal 'asdfasdf', a + assert_raises(Unicorn::HttpParserError) { cr.readpartial(8192) } end def test_eof1 |