aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2014-12-13 14:55:53 +0200
committerLoïc Hoguin <[email protected]>2014-12-13 14:55:53 +0200
commit3863409dde5d178149957a2eefa20e3fe9c9a06e (patch)
treee9d6f95a1bd2e98c575bc0f2c66e1bdb90333c81
parent86917a4c641f01c18f53b34bc4bc89c20549f04a (diff)
downloadcowlib-3863409dde5d178149957a2eefa20e3fe9c9a06e.tar.gz
cowlib-3863409dde5d178149957a2eefa20e3fe9c9a06e.tar.bz2
cowlib-3863409dde5d178149957a2eefa20e3fe9c9a06e.zip
Add testing for bad input for cow_http_hd:parse_content_length/1
-rw-r--r--src/cow_http_hd.erl8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cow_http_hd.erl b/src/cow_http_hd.erl
index e418754..895f88d 100644
--- a/src/cow_http_hd.erl
+++ b/src/cow_http_hd.erl
@@ -533,6 +533,14 @@ parse_content_length_test_() ->
{<<"1234567890 ">>, 1234567890}
],
[{V, fun() -> R = parse_content_length(V) end} || {V, R} <- Tests].
+
+parse_content_length_error_test_() ->
+ Tests = [
+ <<>>,
+ <<"123, 123">>,
+ <<"4.17">>
+ ],
+ [{V, fun() -> {'EXIT', _} = (catch parse_content_length(V)) end} || V <- Tests].
-endif.
-ifdef(PERF).