From 921c47146b2d9567eac7e9a4d2ccc60fffd4f327 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 20 Apr 2020 13:12:32 +0200 Subject: Update the WPT cookie tests --- src/gun_cookies.erl | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/gun_cookies.erl b/src/gun_cookies.erl index ce951c6..ce33b49 100644 --- a/src/gun_cookies.erl +++ b/src/gun_cookies.erl @@ -407,23 +407,8 @@ wpt_http_state_test_files() -> wpt_http_state_test_files(TestPath) -> filelib:wildcard(TestPath ++ "wpt/cookies/*-test") -- [ TestPath ++ "wpt/cookies/attribute0023-test", %% Doesn't match the spec (path override). - TestPath ++ "wpt/cookies/chromium0009-test", %% Doesn't match the spec (empty names). - TestPath ++ "wpt/cookies/chromium0010-test", %% Doesn't match the spec (empty names). - TestPath ++ "wpt/cookies/chromium0012-test", %% Doesn't match the spec (empty names). TestPath ++ "wpt/cookies/disabled-chromium0020-test", %% Doesn't match the spec (empty names). TestPath ++ "wpt/cookies/disabled-chromium0022-test", %% Nonsense. - TestPath ++ "wpt/cookies/mozilla0012-test", %% Doesn't match the spec (empty names). - TestPath ++ "wpt/cookies/mozilla0014-test", %% Doesn't match the spec (empty names). - TestPath ++ "wpt/cookies/mozilla0015-test", %% Doesn't match the spec (empty names). - TestPath ++ "wpt/cookies/mozilla0016-test", %% Doesn't match the spec (empty names). - TestPath ++ "wpt/cookies/mozilla0017-test", %% Doesn't match the spec (empty names). - TestPath ++ "wpt/cookies/name0017-test", %% Doesn't match the spec (empty names). - TestPath ++ "wpt/cookies/name0023-test", %% Doesn't match the spec (empty names). - TestPath ++ "wpt/cookies/name0025-test", %% Doesn't match the spec (empty names). - TestPath ++ "wpt/cookies/name0028-test", %% Doesn't match the spec (empty names). - TestPath ++ "wpt/cookies/name0031-test", %% Doesn't match the spec (name with quotes). - TestPath ++ "wpt/cookies/name0032-test", %% Doesn't match the spec (name with quotes). - TestPath ++ "wpt/cookies/name0033-test", %% Doesn't match the spec (empty names). TestPath ++ "wpt/cookies/optional-domain0042-test" %% Doesn't match the spec (empty domain override). ]. @@ -464,17 +449,12 @@ wpt_http_state_test_() -> {ok, <<"Cookie: ",CookiesBin0/bits>>} -> %% We only care about the first line. [CookiesBin, <<>>|_] = string:split(CookiesBin0, <<"\n">>, all), - ExpectedCookies = cow_cookie:parse_cookie(CookiesBin), - wpt_http_state_test_validate_cookies(Cookies, ExpectedCookies) + CookiesBin = iolist_to_binary(cow_cookie:cookie( + [{Name, Value} || #{name := Name, value := Value} <- Cookies])), + ok end end} || F <- TestFiles]. -wpt_http_state_test_validate_cookies([], []) -> - ok; -wpt_http_state_test_validate_cookies([Cookie|Tail], [{Name, Value}|ExpectedTail]) -> - #{name := Name, value := Value} = Cookie, - wpt_http_state_test_validate_cookies(Tail, ExpectedTail). - %% WPT: path/default wpt_path_default_test() -> URIMap = #{scheme => <<"http">>, host => <>, path => <<"/path/to/resource">>}, -- cgit v1.2.3