about summary refs log tree commit homepage
path: root/test/unit/test_chunked_reader.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-07-16 01:13:33 -0700
committerEric Wong <normalperson@yhbt.net>2009-07-16 01:13:33 -0700
commit2e913054b36848a05f7ba06c3accbe164c666708 (patch)
tree3dbac8d2be3f7ba7a00cd23fff146c40e0a3d747 /test/unit/test_chunked_reader.rb
parenta0f2c4514e969d0a127227201cbdb8e57f71df63 (diff)
downloadunicorn-2e913054b36848a05f7ba06c3accbe164c666708.tar.gz
This simplifies chunked_reader substantially with a slight
increase in tee_input complexity.  This is beneficial because
chunked_reader is more complex to begin with and more likely
to experience correctness issues.
Diffstat (limited to 'test/unit/test_chunked_reader.rb')
-rw-r--r--test/unit/test_chunked_reader.rb59
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