-
Notifications
You must be signed in to change notification settings - Fork 0
/
test
executable file
·42 lines (34 loc) · 1017 Bytes
/
test
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
#!/usr/bin/env bash
modules=(core cli interactive util)
# Load everything
if [[ $0 =~ -portable ]]; then
echo "Testing bash-boost-portable"
source latest/bash-boost-portable.sh
export __bb_test_script="$PWD/latest/bash-boost-portable.sh"
else
echo "Testing bash-boost"
source latest/bash-boost.sh
export __bb_test_script="$PWD/latest/bash-boost.sh"
bb_load "${modules[@]}"
fi
# Make sure bb_expect works
(
bb_expect "foo" "bar" &>/dev/null;
) && bb_fatal "bb_expect not working"
(
bb_expect "foo" "foo" &>/dev/null;
) || bb_fatal "bb_expect not working"
for module in "${modules[@]}"; do
tester="src/$module/_test.sh"
[[ -r "$tester" ]] || bb_fatal "could not read $tester"
source "$tester" || exit 1
done
bb_cleanup
(
set -o posix; set | egrep "^(BB|__bb)_" 2>/dev/null
) && { echo "error: left behind variable(s)"; exit 1; }
(
declare -F | egrep "^declare -f _?bb_" 2>/dev/null
) && { echo "error: left behind function(s)"; exit 1; }
echo "OK"
exit 0