diff options
-rw-r--r-- | src/cow_http_hd.erl | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/cow_http_hd.erl b/src/cow_http_hd.erl index 895f88d..668b80d 100644 --- a/src/cow_http_hd.erl +++ b/src/cow_http_hd.erl @@ -29,6 +29,10 @@ -include("cow_inline.hrl"). +-ifdef(TEST). +-include_lib("triq/include/triq.hrl"). +-endif. + %% @doc Parse the Accept header. -spec parse_accept(binary()) -> [{{binary(), binary(), [{binary(), binary()}]}, qvalue(), [binary() | {binary(), binary()}]}]. @@ -523,6 +527,13 @@ parse_content_length(<< $8, R/bits >>) -> number(R, 8); parse_content_length(<< $9, R/bits >>) -> number(R, 9). -ifdef(TEST). +prop_parse_content_length() -> + ?FORALL( + X, + non_neg_integer(), + X =:= parse_content_length(integer_to_binary(X)) + ). + parse_content_length_test_() -> Tests = [ {<<"0">>, 0}, |