Skip to content
This repository
Browse code

Added test cases.

  • Loading branch information...
commit 6abc02a22edeb518c840763fd291c69549be97de 1 parent 00c152b
Serge Aleynikov saleyn authored

Showing 1 changed file with 16 additions and 0 deletions. Show diff stats Hide diff stats

  1. +16 0 test/eunit/cookies.erl
16 test/eunit/cookies.erl
@@ -305,6 +305,22 @@ real_setcookies_test() ->
305 305 ?assertEqual(ok, parse_set_cookies(Io, file:read_line(Io), 1)),
306 306 ok.
307 307
  308 +set_cookie_test() ->
  309 + ?assertEqual(
  310 + "a=bcd; Version=1; Comment=OK; Max-Age=1; "
  311 + "Expires=Tue, 03 Jan 2012 10:00:05 GMT; HttpOnly; Secure",
  312 + begin
  313 + {header, {set_cookie, L}} = yaws_api:set_cookie("a", "bcd",
  314 + [{expires, {{2012,1,3},{10,0,5}}},
  315 + {max_age, 1}, secure, http_only, {comment, "OK"}]),
  316 + lists:flatten(L)
  317 + end),
  318 + ?assertEqual(
  319 + "a=bcd; Version=1",
  320 + begin
  321 + {header, {set_cookie, L}} = yaws_api:set_cookie("a", "bcd", []),
  322 + lists:flatten(L)
  323 + end).
308 324
309 325 parse_cookies(Io, eof, _) ->
310 326 file:close(Io),

0 comments on commit 6abc02a

Please sign in to comment.
Something went wrong with that request. Please try again.