diff options
Diffstat (limited to 'test/cli.t')
| -rw-r--r-- | test/cli.t | 38 |
1 files changed, 35 insertions, 3 deletions
@@ -17,7 +17,7 @@ A year outside the supported domain is rejected (exit 2): No/garbage arguments give a usage error (exit 2): $ colitur - colitur: usage: colitur easter <year> | colitur temporal <year> | colitur day <year> | colitur readings <year> (try: colitur --help) + colitur: usage: colitur easter <year> | colitur temporal <year> | colitur day <year> | colitur readings <year> | colitur check FILE | colitur new-overlay (try: colitur --help) [2] The EF temporal cycle for a year, one line per day: @@ -327,17 +327,49 @@ A flag needing a value, given none: $ colitur day 2026 --overlay colitur: --overlay needs a file path - colitur: usage: colitur easter <year> | colitur temporal <year> | colitur day <year> | colitur readings <year> (try: colitur --help) + colitur: usage: colitur easter <year> | colitur temporal <year> | colitur day <year> | colitur readings <year> | colitur check FILE | colitur new-overlay (try: colitur --help) [2] An unknown option is rejected rather than treated as a positional word: $ colitur day 2026 --diocese colitur: unknown option --diocese - colitur: usage: colitur easter <year> | colitur temporal <year> | colitur day <year> | colitur readings <year> (try: colitur --help) + colitur: usage: colitur easter <year> | colitur temporal <year> | colitur day <year> | colitur readings <year> | colitur check FILE | colitur new-overlay (try: colitur --help) [2] The shipped example overlay is runnable documentation, and it must actually load -- an example that silently rotted would be worse than none. The cram sandbox cannot reach data/, so the assertion that it loads and applies lives in test_lectionary_ef.ml, which reads it from the source tree directly. + +`new-overlay` prints a starter file to stdout for redirection, and what it +prints must itself be valid -- a template that does not load is worse than no +template, because it teaches the wrong shape. Round-tripped here rather than +pinned line by line, so editing the template's prose does not fail this test +while a syntax error in it still does: + + $ colitur new-overlay > starter.sexp + $ colitur check starter.sexp + starter.sexp: ok -- overlay my-parish, 2 directive(s): 2 add, 0 suppress, 0 replace, 0 edit + every directive found its target + add my-local-patron + add my-dedication + +`check` exits 2 when a directive matches nothing, so it is usable in a +Makefile or a pre-commit hook, not merely readable: + + $ printf '((id p) (directives ((Suppress no-such-slug))))' > bad.sexp + $ colitur check bad.sexp + bad.sexp: ok -- overlay p, 1 directive(s): 0 add, 1 suppress, 0 replace, 0 edit + MATCHED NOTHING: overlay p: suppress no-such-slug: slug not present; nothing to suppress + suppress no-such-slug + [2] + +`citations` and `layer` may be omitted from an added celebration; they default +to empty and to the overlay's own id: + + $ printf '((id tiny) (directives ((Add ((date (Fixed (month 5) (day 20))) (cel ((slug tiny-feast) (names ((en "Tiny"))) (rank Class3) (status Feast) (colour White) (subject Saint))))))))' > tiny.sexp + $ colitur check tiny.sexp + tiny.sexp: ok -- overlay tiny, 1 directive(s): 1 add, 0 suppress, 0 replace, 0 edit + every directive found its target + add tiny-feast |
