aboutsummaryrefslogtreecommitdiff
path: root/test/test_ics.ml
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_ics.ml')
-rw-r--r--test/test_ics.ml16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/test_ics.ml b/test/test_ics.ml
index 7d1ca37..fef20c7 100644
--- a/test/test_ics.ml
+++ b/test/test_ics.ml
@@ -78,6 +78,20 @@ let test_text_escaped () =
let rec f i = i + n <= String.length joseph && (String.sub joseph i n = re || f (i + 1)) in
f 0)
+(* W5: like [Emit_xml] and unlike [Emit_csv], DESCRIPTION is free text, not
+ a fixed column -- a [Second] reading is a third joined line, not a
+ breaking schema change. [second] is spliced BETWEEN [first]/[gospel]
+ (reading order, OLM 1981 Praenotanda n. 69.1), matching
+ [Emit_xml.day]'s own ordering. Asserts the exact line rather than a
+ substring: short enough (69 octets incl. the "DESCRIPTION:" property
+ name) to stay under RFC 5545's 75-octet fold threshold, so it is one
+ physical line, not merely one logical property split across several. *)
+let test_description_carries_second_reading_in_order () =
+ let ls = lines (Ics.year (Test_view.three_citation_view ())) in
+ let desc = List.find (fun l -> count_prefix "DESCRIPTION:" [ l ] = 1) ls in
+ Alcotest.(check string) "Epistle, Second, Gospel, in that order"
+ "DESCRIPTION:Epistle Rom 1:1-7\\nSecond 1 Cor 1:3-9\\nGospel John 1:1-14" desc
+
let test_dtstamp_is_a_parameter () =
let a = Ics.year ~dtstamp:"20200101T000000Z" (Test_view.view_of 2027) in
let b = Ics.year ~dtstamp:"20210101T000000Z" (Test_view.view_of 2027) in
@@ -138,6 +152,8 @@ let suite =
Alcotest.test_case "folded and CRLF" `Quick test_every_line_folded_and_crlf;
Alcotest.test_case "no RRULE" `Quick test_no_rrule;
Alcotest.test_case "text escaped" `Quick test_text_escaped;
+ Alcotest.test_case "description carries second reading in order" `Quick
+ test_description_carries_second_reading_in_order;
Alcotest.test_case "DTSTAMP is a parameter" `Quick test_dtstamp_is_a_parameter;
Alcotest.test_case "DTEND omitted at domain end" `Quick test_dtend_omitted_at_domain_end;
Alcotest.test_case "all 9999 DTENDs are eight digits" `Quick test_all_9999_dtends_are_eight_digits ] )