forked from fboender/multi-git-status
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathrun-tests.sh
More file actions
executable file
·38 lines (36 loc) · 744 Bytes
/
run-tests.sh
File metadata and controls
executable file
·38 lines (36 loc) · 744 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
#!/bin/bash
check(){
local got="$1"
local expected="$2"
if [[ "$got" != "$expected" ]]; then
echo "-> Expected:"
echo "$expected"
echo "-> Got:"
echo "$got"
exit 1
fi
}
cwd=$PWD
TESTS_DIR="$cwd/tests/__tmp__"
[[ -d "$TESTS_DIR" ]] && rm -rf "$TESTS_DIR"
bin="$PWD/mgitstatus"
export bin
export TESTS_DIR
export -f check
out=$(mktemp)
echo "Running tests:"
echo "--------------"
for test in $cwd/tests/*; do
mkdir "$TESTS_DIR"
cd "$TESTS_DIR"
if $test > $out 2>&1; then
echo "Passed: $(basename $test)"
rm -rf "$TESTS_DIR" 2> /dev/null
else
echo "Failed in $(basename $test)"
cat $out
rm $out
exit 1
fi
done
rm $out