diff options
Diffstat (limited to 'test/test_names.ml')
| -rw-r--r-- | test/test_names.ml | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/test/test_names.ml b/test/test_names.ml index 9db8217..f340c62 100644 --- a/test/test_names.ml +++ b/test/test_names.ml @@ -74,6 +74,25 @@ let test_date_spec_sexp_roundtrip () = Alcotest.(check bool) "sexp roundtrip" true (ds = ds') | Error e -> Alcotest.failf "fixed: %s" e) +module Cel = Colitur_kernel.Celebration +module S = Colitur_kernel.Slug +module Col = Colitur_kernel.Colour +module Sub = Colitur_kernel.Subject + +(* A throwaway rank vocabulary, to exercise the parametric type. *) +type demo_rank = High | Low [@@deriving sexp] + +let test_celebration () = + let c = + Cel.make ~slug:(S.of_string_exn "ef-easter-sunday") + ~names:(N.of_list [ (lang "la", "Dominica Resurrectionis") ]) + ~rank:High ~colour:Col.White ~subject:Sub.Lord ~layer:"temporal" () + in + Alcotest.(check string) "slug" "ef-easter-sunday" (S.to_string c.Cel.slug); + Alcotest.(check bool) "default citations empty" true (c.Cel.citations = []); + let sexp = Cel.sexp_of_t sexp_of_demo_rank c in + Alcotest.(check bool) "sexp roundtrip" true (Cel.t_of_sexp demo_rank_of_sexp sexp = c) + let suite = ( "Names/Citation/DateSpec", [ Alcotest.test_case "names basics" `Quick test_names_basics; @@ -83,4 +102,5 @@ let suite = Alcotest.test_case "names sexp roundtrip" `Quick test_names_sexp_roundtrip; Alcotest.test_case "citation" `Quick test_citation; Alcotest.test_case "date_spec" `Quick test_date_spec; - Alcotest.test_case "date_spec sexp roundtrip" `Quick test_date_spec_sexp_roundtrip ] ) + Alcotest.test_case "date_spec sexp roundtrip" `Quick test_date_spec_sexp_roundtrip; + Alcotest.test_case "celebration" `Quick test_celebration ] ) |
