diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-11-19 20:51:57 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-11-20 06:51:58 +0800 |
commit | 5bc239fd154a7eaebeb024394f8e0b507bbf4c5a (patch) | |
tree | 1962f3f02e5fb7dfe0b3f533e053b8d1bee330fb /test/unit | |
parent | d12e10ea88c7adeb97094e4b835201e4c2ce52ab (diff) | |
download | unicorn-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/unit')
-rw-r--r-- | test/unit/test_stream_input.rb | 7 |
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) |