forked from omacom/omarchy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshell
More file actions
executable file
·36 lines (29 loc) · 929 Bytes
/
Copy pathshell
File metadata and controls
executable file
·36 lines (29 loc) · 929 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
set -euo pipefail
ROOT=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)
TEST_DIR="$ROOT/test/shell.d"
shopt -s nullglob
tests=()
for test in "$TEST_DIR"/*-test.sh; do
[[ $(basename "$test") == "base-test.sh" ]] && continue
tests+=("$test")
done
shopt -u nullglob
if (( ${#tests[@]} == 0 )); then
echo "No shell tests found in $TEST_DIR" >&2
exit 1
fi
# Keep going after a failing file. A test file exits at its first failed
# assertion, so aborting the run there too would hide every file after it --
# one packaging failure was masking 114 of 134 files.
failed=()
for test in "${tests[@]}"; do
printf '==> %s\n' "${test#$ROOT/}"
bash "$test" || failed+=("${test#$ROOT/}")
done
if (( ${#failed[@]} > 0 )); then
printf '\n%d of %d test files failed:\n' "${#failed[@]}" "${#tests[@]}" >&2
printf ' %s\n' "${failed[@]}" >&2
exit 1
fi
printf '\nAll %d test files passed.\n' "${#tests[@]}"