Add bats test suite for image processing scripts

Tests cover skip-already-processed logic, cleanup, idempotency, and
the config.sh single-source-of-truth invariant. bats-core, bats-assert,
and bats-support added as submodules under tests/libs/.
This commit is contained in:
2026-07-03 19:49:04 -04:00
parent 6901c66bcf
commit f5ed6617c5
11 changed files with 233 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
#!/bin/bash
# Mock for ~/Applications/magick.
# identify: delegate to real system identify.
# convert (resize call): copy in-place and embed the comment so the file
# looks processed on the next run.
if [ "$1" = "identify" ]; then
shift
identify "$@"
exit $?
fi
# Parse -set comment <value> and the output file (last arg) from the argument list
COMMENT=""
OUTFILE="${@: -1}"
args=("$@")
for i in "${!args[@]}"; do
if [ "${args[$i]}" = "-set" ] && [ "${args[$i+1]}" = "comment" ]; then
COMMENT="${args[$i+2]}"
fi
done
if [ -n "$COMMENT" ]; then
convert "$OUTFILE" -set comment "$COMMENT" "$OUTFILE"
fi