Add bats test suite

Black-box tests that run the script with stub commands on a minimal PATH and temp config/state folders.
This commit is contained in:
Daniele Fucini
2026-11-09 19:51:42 +01:00
parent 1328cd5eca
commit bd8ded486d
9 changed files with 456 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
#!/bin/bash
# Prints $STUB_DATA/checkupdates; exits $CHECKUPDATES_RC, else 0 with updates and 2 without, like the real one.
printf '%s %s\n' "${0##*/}" "$*" >> "$STUB_DATA/calls"
if [[ -s $STUB_DATA/checkupdates ]]; then
printf '%s\n' "$(<"$STUB_DATA/checkupdates")"
exit "${CHECKUPDATES_RC:-0}"
fi
exit "${CHECKUPDATES_RC:-2}"