-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_all.sh
More file actions
executable file
·50 lines (47 loc) · 878 Bytes
/
test_all.sh
File metadata and controls
executable file
·50 lines (47 loc) · 878 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash -eu
source core/color.sh
source core/assert.sh
source core/source.sh
for f in tests/*.sh
do
# shellcheck source=/dev/null
source "${f}"
done
# find all functions that start with "test*"
# and run them one by one accumulating results
IFS=$'\n'
count=0
count_ok=0
count_er=0
for f in $(declare -F)
do
name="${f:11}"
if [[ "${name}" =~ ^test* ]]
then
echo -n "running [${name}]..."
res=0
(( count+=1 ))
("${name}") || res=${?}
if [ "${res}" == "0" ]
then
_bashy_cecho g "OK" 0
(( count_ok+=1 ))
else
_bashy_cecho r "ERROR" 0
(( count_er+=1 ))
fi
fi
done
echo "summary"
echo "number of tests run --> ${count}"
echo -n "number of tests ok --> "
_bashy_cecho g "${count_ok}" 0
echo -n "number of tests failed --> "
if [ "${count_er}" -eq 0 ]
then
_bashy_cecho g "${count_er}" 0
exit 0
else
_bashy_cecho r "${count_er}" 0
exit 1
fi