Files

34 lines
625 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
if command -v bats >/dev/null 2>&1; then
exec bats "$ROOT_DIR/tests"
fi
# Minimal internal test runner (fallback when bats is not installed)
echo "[info] bats not found; using internal test runner" >&2
failures=0
total=0
for t in "$ROOT_DIR"/tests/*.sh; do
[ -f "$t" ] || continue
total=$((total+1))
echo "[run] $t"
if bash "$t"; then
echo "[ok] $t"
else
echo "[fail] $t" >&2
failures=$((failures+1))
fi
done
echo "[summary] total=$total failures=$failures"
if [ "$failures" -ne 0 ]; then
exit 1
fi
exit 0