aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/cli.t32
1 files changed, 31 insertions, 1 deletions
diff --git a/test/cli.t b/test/cli.t
index 288356c..d7e86f7 100644
--- a/test/cli.t
+++ b/test/cli.t
@@ -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>
+ colitur: usage: colitur easter <year> | colitur temporal <year> | colitur day <year> | colitur readings <year> (try: colitur --help)
[2]
The EF temporal cycle for a year, one line per day:
@@ -211,3 +211,33 @@ with a confusing per-file error. (Exercised directly in the task, by creating
_build/default/share/colitur/ef and confirming the year still resolves; not
reproduced here because the cram sandbox's own exe path makes the layout
awkward to stage without asserting on dune internals.)
+
+Help and usage are different things, and the difference is the Unix
+convention rather than a preference. Asking for help is a request that
+SUCCEEDED: it goes to standard output and exits 0, so it can be piped into a
+pager or grepped. Being invoked wrongly is an error: a one-liner to standard
+error, exit 2, leaving stdout clean for whatever the caller was really trying
+to capture.
+
+ $ colitur --help | head -1
+ colitur -- deterministic liturgical calendar engine (Roman rite, 1962)
+
+ $ colitur -h | head -1
+ colitur -- deterministic liturgical calendar engine (Roman rite, 1962)
+
+ $ colitur --help > /dev/null
+ $ colitur -h > /dev/null
+
+Nothing on stderr, and exit 0 (an exit other than 0 would print a [N] line):
+
+ $ colitur --help 2>&1 >/dev/null
+
+The error path is the mirror image -- nothing on stdout, exit 2:
+
+ $ colitur bogus 2>/dev/null
+ [2]
+
+Every command the help lists is a command the binary actually accepts. This
+is the check that catches help text drifting away from the dispatch:
+
+ $ for c in easter temporal day readings; do colitur $c 2026 > /dev/null || echo "$c FAILED"; done