Skip to content

Commit 16ab640

Browse files
committed
refactor tests
1 parent c7def7d commit 16ab640

File tree

13 files changed

+10967
-82
lines changed

13 files changed

+10967
-82
lines changed

β€Žtests/bashtest.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
3+
# decor
4+
RED='\033[0;31m'
5+
GREEN='\033[0;32m'
6+
NC='\033[0m'
7+
8+
# test state
9+
TESTS=0
10+
FAILED=0
11+
12+
# Verify that a command succeeds
13+
function assert_success() {
14+
MESSAGE="$1"
15+
shift
16+
COMMAND="$@"
17+
18+
((++TESTS))
19+
20+
if $COMMAND
21+
then
22+
echo -e "πŸ‘ ${GREEN} $MESSAGE: success${NC}"
23+
else
24+
echo -e "πŸ‘Ž ${RED} ${MESSAGE}: fail${NC}"
25+
((++FAILED))
26+
fi
27+
}
28+
29+
function end_tests() {
30+
if ((FAILED > 0))
31+
then
32+
echo
33+
echo -e "πŸ’€ ${RED} Ran ${TESTS} tests, ${FAILED} failed.${NC}"
34+
exit $FAILED
35+
else
36+
echo
37+
echo -e "πŸ‘Œ ${GREEN} ${TESTS} tests passed.${NC}"
38+
exit 0
39+
fi
40+
}

β€Žtests/test-func-dev/.gitignore

Whitespace-only changes.

0 commit comments

Comments
Β (0)