diff options
author | Loïc Hoguin <[email protected]> | 2013-04-26 15:13:24 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2013-04-26 15:13:24 +0200 |
commit | 9ccfbb66ef24c84f34b3248057fe461f751389d5 (patch) | |
tree | d42fbfacb7dfc05e4bdbfcc100e60452890e7e78 /src/cowboy_req.erl | |
parent | 5291c3eb0ac421994fb3046fc0fcd603b4ea2a64 (diff) | |
parent | 3bf5b46786136a004b4085098c9b46cd47295774 (diff) | |
download | cowboy-9ccfbb66ef24c84f34b3248057fe461f751389d5.tar.gz cowboy-9ccfbb66ef24c84f34b3248057fe461f751389d5.tar.bz2 cowboy-9ccfbb66ef24c84f34b3248057fe461f751389d5.zip |
Merge branch 'remove_asserts' of git://github.com/Egobrain/cowboy
Diffstat (limited to 'src/cowboy_req.erl')
-rw-r--r-- | src/cowboy_req.erl | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/src/cowboy_req.erl b/src/cowboy_req.erl index 11b0e26..552048a 100644 --- a/src/cowboy_req.erl +++ b/src/cowboy_req.erl @@ -115,10 +115,6 @@ -export([lock/1]). -export([to_list/1]). --ifdef(TEST). --include_lib("eunit/include/eunit.hrl"). --endif. - -type cookie_option() :: {max_age, non_neg_integer()} | {domain, binary()} | {path, binary()} | {secure, boolean()} | {http_only, boolean()}. @@ -1471,26 +1467,20 @@ connection_to_atom_test_() -> [{lists:flatten(io_lib:format("~p", [T])), fun() -> R = connection_to_atom(T) end} || {T, R} <- Tests]. -merge_headers_test() -> - Left0 = [{<<"content-length">>,<<"13">>},{<<"server">>,<<"Cowboy">>}], - Right0 = [{<<"set-cookie">>,<<"foo=bar">>},{<<"content-length">>,<<"11">>}], - - ?assertMatch( - [{<<"set-cookie">>,<<"foo=bar">>}, - {<<"content-length">>,<<"13">>}, - {<<"server">>,<<"Cowboy">>}], - merge_headers(Left0, Right0)), - - Left1 = [{<<"content-length">>,<<"13">>},{<<"server">>,<<"Cowboy">>}], - Right1 = [{<<"set-cookie">>,<<"foo=bar">>},{<<"set-cookie">>,<<"bar=baz">>}], - - ?assertMatch( - [{<<"set-cookie">>,<<"bar=baz">>}, - {<<"set-cookie">>,<<"foo=bar">>}, - {<<"content-length">>,<<"13">>}, - {<<"server">>,<<"Cowboy">>}], - merge_headers(Left1, Right1)), - - ok. +merge_headers_test_() -> + Tests = [ + {[{<<"content-length">>,<<"13">>},{<<"server">>,<<"Cowboy">>}], + [{<<"set-cookie">>,<<"foo=bar">>},{<<"content-length">>,<<"11">>}], + [{<<"set-cookie">>,<<"foo=bar">>}, + {<<"content-length">>,<<"13">>}, + {<<"server">>,<<"Cowboy">>}]}, + {[{<<"content-length">>,<<"13">>},{<<"server">>,<<"Cowboy">>}], + [{<<"set-cookie">>,<<"foo=bar">>},{<<"set-cookie">>,<<"bar=baz">>}], + [{<<"set-cookie">>,<<"bar=baz">>}, + {<<"set-cookie">>,<<"foo=bar">>}, + {<<"content-length">>,<<"13">>}, + {<<"server">>,<<"Cowboy">>}]} + ], + [fun() -> Res = merge_headers(L,R) end || {L, R, Res} <- Tests]. -endif. |