more tests

This commit is contained in:
Benedetta 2024-04-24 09:34:19 +02:00
parent 17d314550d
commit 8b695ac466

View file

@ -1,12 +1,11 @@
open Pam.Datatypes
open Alcotest open Alcotest
open Pam.Datatypes
let pprint_ptime ppf x = Fmt.pf ppf "%s" (Ptime.to_rfc3339 x) let pprint_ptime ppf x = Fmt.pf ppf "%s" (Ptime.to_rfc3339 x)
let ptime_testable = Alcotest.testable pprint_ptime Ptime.equal let ptime_testable = Alcotest.testable pprint_ptime Ptime.equal
let test_parse () = let test_parse () =
let body = {|@alert: -12:38 10:02 +09:24 let body = {|@alert: -12:38 10:02 +09:24 --10:00 +++23:00
## Description ## Description
@ -23,6 +22,8 @@ let test_parse () =
"2024-04-19T12:38:00+02:00" ; "2024-04-19T12:38:00+02:00" ;
"2024-04-20T10:02:00+02:00" ; "2024-04-20T10:02:00+02:00" ;
"2024-04-21T09:24:00+02:00" ; "2024-04-21T09:24:00+02:00" ;
"2024-04-18T10:00:00+02:00" ;
"2024-04-23T23:00:00+02:00" ;
] |> List.map (fun e -> e |> Ptime.of_rfc3339 |> Result.get_ok |> function | t, _, _ -> t) in ] |> List.map (fun e -> e |> Ptime.of_rfc3339 |> Result.get_ok |> function | t, _, _ -> t) in
let res = Pam.Issue_parser.to_datetime reminder in let res = Pam.Issue_parser.to_datetime reminder in
match res with match res with