Browse Source

Add testing for bad input for cow_http_hd:parse_content_length/1

Loïc Hoguin 10 years ago
parent
commit
3863409dde
1 changed files with 8 additions and 0 deletions
  1. 8 0
      src/cow_http_hd.erl

+ 8 - 0
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).