From 5bc239fd154a7eaebeb024394f8e0b507bbf4c5a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 19 Nov 2010 20:51:57 +0000 Subject: stream_input: small cleanups and fixes 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. --- test/unit/test_stream_input.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test') 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) -- cgit v1.2.3-24-ge0c7