From 85c2d0034f51d2d1ffae97e60a6028d896ff688a Mon Sep 17 00:00:00 2001 From: Gerry Agbobada Date: Sun, 31 Dec 2023 22:14:05 +0100 Subject: [PATCH] Add failing tests for timestamps with headlines --- test/test_org.ml | 103 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/test/test_org.ml b/test/test_org.ml index f311ce8..3fbda56 100644 --- a/test/test_org.ml +++ b/test/test_org.ml @@ -283,6 +283,109 @@ let block = ; size = None }) ) ] ) + ; ( "Headline with timestamps" + , testcases + [ ( "Schedule" + , `Quick + , check_aux "* aaa\nSCHEDULED: <1999-03-31 Wed>" + (Type.Heading + { title = [ (I.Plain "aaa", None) ] + ; tags = [ ] + ; marker = None + ; level = 1 + ; numbering = None + ; priority = None + ; anchor = "aaa" + ; meta = { Type.timestamps = [ I.Scheduled + { date = + { day = 31 + ; month = 3 + ; year = 1999 + } + ; time = None + ; repetition = None + ; wday = "Wed" + ; active = true + } ] + ; properties = [] } + ; unordered = true + ; size = None + }) ) + ; ( "Schedule repeater" + , `Quick + , check_aux "* aaa\nSCHEDULED: <1999-03-31 Wed .+1y>" + (Type.Heading + { title = [ (I.Plain "aaa", None) ] + ; tags = [ ] + ; marker = None + ; level = 1 + ; numbering = None + ; priority = None + ; anchor = "aaa" + ; meta = { Type.timestamps = [ I.Scheduled + { date = + { day = 31 + ; month = 3 + ; year = 1999 + } + ; time = None + ; repetition = Some (Dotted, Year, 1) + ; wday = "Wed" + ; active = true + } ] + ; properties = [] } + ; unordered = true + ; size = None + }) ) + ; ( "Schedule repeater and deadline" + , `Quick + , check_aux "* aaa [[link][label]] :bb:cc:\nSCHEDULED: <1999-03-31 Wed 12:00-12:30 ++2w>\nDEADLINE: <1999-04-01 Thu>" + (Type.Heading + { title = + [ (I.Plain "aaa ", None) + ; ( I.Link + { I.url = I.Search "link" + ; label = [ I.Plain "label" ] + ; title = None + ; full_text = "[[link][label]]" + ; metadata = "" + } + , None ) + ] + ; tags = [ "bb"; "cc" ] + ; marker = None + ; level = 1 + ; numbering = None + ; priority = None + ; anchor = "aaa_label" + ; meta = { Type.timestamps = [ I.Scheduled + { date = + { day = 31 + ; month = 3 + ; year = 1999 + } + (* Having a time range like 12:00-12:30 doesn’t seem supported *) + ; time = Some { hour = 12; min = 0 } + ; repetition = Some (DoublePlus, Week, 2) + ; wday = "Wed" + ; active = true + } + ; I.Deadline + { date = + { day = 1 + ; month = 4 + ; year = 1999 + } + ; time = None + ; repetition = None + ; wday = "Thu" + ; active = true + } ] + ; properties = [] } + ; unordered = true + ; size = None + }) ) + ] ) ] let () = Alcotest.run "mldoc" @@ List.concat [ block; inline ]