Skip to content

Commit

Permalink
Add failing tests for timestamps with headlines
Browse files Browse the repository at this point in the history
  • Loading branch information
gagbo committed Dec 31, 2023
1 parent 6601fa5 commit 3b29ad7
Showing 1 changed file with 108 additions and 1 deletion.
109 changes: 108 additions & 1 deletion test/test_org.ml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,11 @@ let block =
, check_aux
":PROPERTIES:\n:XXX: 1\n:yyy: 2\n:END:\n#+ZZZ: 3\n#+UUU: 4"
(Property_Drawer
[ ("XXX", "1", []); ("yyy", "2", []); ("ZZZ", "3", []); ("UUU", "4", []) ]) )
[ ("XXX", "1", [])
; ("yyy", "2", [])
; ("ZZZ", "3", [])
; ("UUU", "4", [])
]) )
; ( "no drawer in quote"
, `Quick
, check_aux "#+BEGIN_QUOTE\na:: b\n#+END_QUOTE"
Expand Down Expand Up @@ -283,6 +287,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:\n\
SCHEDULED: <1999-03-31 Wed 12:00-12:30 ++2w>\n\
DEADLINE: <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 ]

0 comments on commit 3b29ad7

Please sign in to comment.