about summary refs log tree commit homepage
path: root/test
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-11-19 20:51:57 +0000
committerEric Wong <normalperson@yhbt.net>2010-11-20 06:51:58 +0800
commit5bc239fd154a7eaebeb024394f8e0b507bbf4c5a (patch)
tree1962f3f02e5fb7dfe0b3f533e053b8d1bee330fb /test
parentd12e10ea88c7adeb97094e4b835201e4c2ce52ab (diff)
downloadunicorn-5bc239fd154a7eaebeb024394f8e0b507bbf4c5a.tar.gz
No need to accept any number of args, that could hide bugs in
applications that could give three or more arguments.  We also
raise ArgumentError when given a negative length argument to
read.
Diffstat (limited to 'test')
-rw-r--r--test/unit/test_stream_input.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/unit/test_stream_input.rb b/test/unit/test_stream_input.rb
index adf4571..0c4ec98 100644
--- a/test/unit/test_stream_input.rb
+++ b/test/unit/test_stream_input.rb
@@ -21,6 +21,13 @@ class TestStreamInput < Test::Unit::TestCase
     Process.waitall
   end
 
+  def test_read_negative
+    r = init_request('hello')
+    si = Unicorn::StreamInput.new(@rd, r)
+    assert_raises(ArgumentError) { si.read(-1) }
+    assert_equal 'hello', si.read
+  end
+
   def test_read_small
     r = init_request('hello')
     si = Unicorn::StreamInput.new(@rd, r)