From 3863409dde5d178149957a2eefa20e3fe9c9a06e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Sat, 13 Dec 2014 14:55:53 +0200 Subject: Add testing for bad input for cow_http_hd:parse_content_length/1 --- src/cow_http_hd.erl | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/cow_http_hd.erl') 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). -- cgit v1.2.3