-
Notifications
You must be signed in to change notification settings - Fork 499
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·35 lines (29 loc) · 783 Bytes
/
Copy pathtest.sh
File metadata and controls
executable file
·35 lines (29 loc) · 783 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
#!/usr/bin/env bash
set -uo pipefail
if ((BASH_VERSINFO[0] < 4)) || ((BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] < 3)); then
echo "Error: Bash version must be >= 4.3"
if [[ "$OSTYPE" == "darwin"* ]]; then
echo "Please install latest bash via brew: brew install bash"
fi
exit 1
fi
function out() {
printf "\n\e[1;37;497;m%s\e[0;m\n" "$@"
} >&2
function err() {
printf "\n\e[1;37;41;m%s\e[0;m\n\n" "$@"
} >&2
retval=0
cd "$(dirname "${BASH_SOURCE}")"
for file in test/*.test.sh; do
out "Running $file"
if grep -E "^[[:blank:]]*BACH_TESTS=.+" "$file"; then
err "Found defination of BACH_TESTS in $file"
retval=1
fi
bash "$file" || retval=1
done
if [[ "$retval" -ne 0 ]]; then
err "Test failed!"
fi
exit "$retval"