Files
small-scripts/tests/run-all.sh
Paul O'Reilly d7c8814a5a Initial project setup for small-scripts
Spec-driven utility script collection with dryrun support and
automated testing. Includes project docs, test runner, and
directory structure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 10:14:53 +13:00

42 lines
891 B
Bash
Executable File

#!/usr/bin/env bash
# Run all test scripts and summarise results
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PASS=0
FAIL=0
FAILED_TESTS=()
for test_script in "$SCRIPT_DIR"/test-*.sh; do
[ -f "$test_script" ] || continue
name="$(basename "$test_script")"
printf "Running %s... " "$name"
if bash "$test_script"; then
printf "\033[32mPASS\033[0m\n"
PASS=$((PASS + 1))
else
printf "\033[31mFAIL\033[0m\n"
FAIL=$((FAIL + 1))
FAILED_TESTS+=("$name")
fi
done
echo ""
echo "Results: $PASS passed, $FAIL failed"
if [ "$FAIL" -gt 0 ]; then
echo ""
echo "Failed tests:"
for t in "${FAILED_TESTS[@]}"; do
printf " \033[31m✗\033[0m %s\n" "$t"
done
exit 1
fi
if [ "$PASS" -eq 0 ]; then
echo "No tests found."
exit 0
fi
printf "\033[32mAll tests passed.\033[0m\n"