diff --git a/lib_test/Helpers.ml b/lib_test/Helpers.ml index 2e3bb62..360b383 100644 --- a/lib_test/Helpers.ml +++ b/lib_test/Helpers.ml @@ -15,9 +15,6 @@ let check_option_string = Alcotest.(check (option string)) let check_int = Alcotest.(check int) - -let opt_of_result = function -| Ok v -> Some v -| _ -> None +let opt_of_result = function Ok v -> Some v | _ -> None let hd_safe ~default l = try Base.List.hd_exn l with Failure _ -> default diff --git a/lib_test/test_date.ml b/lib_test/test_date.ml index e31f533..b951af8 100644 --- a/lib_test/test_date.ml +++ b/lib_test/test_date.ml @@ -28,55 +28,68 @@ let tests = Alcotest.test_case "serialize" `Quick (fun () -> let expected = "Mon, 06 Jan 2020 08:04:19 UTC" in check_result_string expected (Ok expected) - (Base.Result.map ~f:Cookie.Date.serialize (Cookie.Date.parse expected))); + (Base.Result.map ~f:Cookie.Date.serialize + (Cookie.Date.parse expected))); Alcotest.test_case "serialize" `Quick (fun () -> let expected = "Tue, 11 Feb 2020 09:04:19 UTC" in check_result_string "" (Ok expected) - (Base.Result.map ~f:Cookie.Date.serialize (Cookie.Date.parse expected))); + (Base.Result.map ~f:Cookie.Date.serialize + (Cookie.Date.parse expected))); Alcotest.test_case "serialize" `Quick (fun () -> let expected = "Wed, 25 Mar 2020 10:04:19 UTC" in check_result_string "" (Ok expected) - (Base.Result.map ~f:Cookie.Date.serialize (Cookie.Date.parse expected))); + (Base.Result.map ~f:Cookie.Date.serialize + (Cookie.Date.parse expected))); Alcotest.test_case "serialize" `Quick (fun () -> let expected = "Thu, 02 Apr 2020 11:04:19 UTC" in check_result_string "" (Ok expected) - (Base.Result.map ~f:Cookie.Date.serialize (Cookie.Date.parse expected))); + (Base.Result.map ~f:Cookie.Date.serialize + (Cookie.Date.parse expected))); Alcotest.test_case "serialize" `Quick (fun () -> let expected = "Fri, 01 May 2020 12:04:19 UTC" in check_result_string "" (Ok expected) - (Base.Result.map ~f:Cookie.Date.serialize (Cookie.Date.parse expected))); + (Base.Result.map ~f:Cookie.Date.serialize + (Cookie.Date.parse expected))); Alcotest.test_case "serialize" `Quick (fun () -> let expected = "Sat, 27 Jun 2020 13:04:19 UTC" in check_result_string "" (Ok expected) - (Base.Result.map ~f:Cookie.Date.serialize (Cookie.Date.parse expected))); + (Base.Result.map ~f:Cookie.Date.serialize + (Cookie.Date.parse expected))); Alcotest.test_case "serialize" `Quick (fun () -> let expected = "Sun, 12 Jul 2020 14:04:19 UTC" in check_result_string "" (Ok expected) - (Base.Result.map ~f:Cookie.Date.serialize (Cookie.Date.parse expected))); + (Base.Result.map ~f:Cookie.Date.serialize + (Cookie.Date.parse expected))); Alcotest.test_case "serialize" `Quick (fun () -> let expected = "Mon, 31 Aug 2020 15:04:19 UTC" in check_result_string "" (Ok expected) - (Base.Result.map ~f:Cookie.Date.serialize (Cookie.Date.parse expected))); + (Base.Result.map ~f:Cookie.Date.serialize + (Cookie.Date.parse expected))); Alcotest.test_case "serialize" `Quick (fun () -> let expected = "Tue, 22 Sep 2020 16:04:19 UTC" in check_result_string "" (Ok expected) - (Base.Result.map ~f:Cookie.Date.serialize (Cookie.Date.parse expected))); + (Base.Result.map ~f:Cookie.Date.serialize + (Cookie.Date.parse expected))); Alcotest.test_case "serialize" `Quick (fun () -> let expected = "Wed, 07 Oct 2020 17:04:19 UTC" in check_result_string "" (Ok expected) - (Base.Result.map ~f:Cookie.Date.serialize (Cookie.Date.parse expected))); + (Base.Result.map ~f:Cookie.Date.serialize + (Cookie.Date.parse expected))); Alcotest.test_case "serialize" `Quick (fun () -> let expected = "Thu, 19 Nov 2020 18:04:19 UTC" in check_result_string "" (Ok expected) - (Base.Result.map ~f:Cookie.Date.serialize (Cookie.Date.parse expected))); + (Base.Result.map ~f:Cookie.Date.serialize + (Cookie.Date.parse expected))); Alcotest.test_case "serialize" `Quick (fun () -> let expected = "Fri, 25 Dec 2020 19:04:19 UTC" in check_result_string "" (Ok expected) - (Base.Result.map ~f:Cookie.Date.serialize (Cookie.Date.parse expected))); + (Base.Result.map ~f:Cookie.Date.serialize + (Cookie.Date.parse expected))); Alcotest.test_case "serialize" `Quick (fun () -> let expected = "Mon, 16 Nov 2020 08:04:19 UTC" in check_result_string "" (Ok expected) - (Base.Result.map ~f:Cookie.Date.serialize (Cookie.Date.parse expected))); + (Base.Result.map ~f:Cookie.Date.serialize + (Cookie.Date.parse expected))); ] ) let suite, _ = diff --git a/lib_test/test_http_state.ml b/lib_test/test_http_state.ml index 75189e1..5bbe7e7 100644 --- a/lib_test/test_http_state.ml +++ b/lib_test/test_http_state.ml @@ -60,12 +60,13 @@ let tests = if key = "Set-Cookie" then Some (key, value) else None) test_headers |> Base.List.filter_map - ~f:(Cookie.of_set_cookie_header ~origin:"home.example.org") + ~f: + (Cookie.of_set_cookie_header ~origin:"home.example.org") in let now = - Base.Option.( Cookie.Date.parse "Wen, 28 Feb 2018 08:04:19 GMT" - |> opt_of_result - >>= Ptime.of_date_time ) + Base.Option.( + Cookie.Date.parse "Wen, 28 Feb 2018 08:04:19 GMT" + |> opt_of_result >>= Ptime.of_date_time) in let test = set_cookie_headers |> Cookie.to_cookie_header ?now ~scope