forked from RareSkills/Solidity-Exercises
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.sh
More file actions
33 lines (27 loc) · 647 Bytes
/
test.sh
File metadata and controls
33 lines (27 loc) · 647 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
#!/bin/bash
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'
failed_tests=()
success_test_counter=0
for dir in */; do
cd "$dir"
echo "Testing $dir:"
forge test -vvv
return_code=$?
cd ..
if [ $return_code -ne 0 ]; then
failed_tests+=("${dir%?}")
else
success_test_counter=$((success_test_counter+1))
fi
done
echo -e "${GREEN}Successful tests: $success_test_counter${NC}"
if [ ${#failed_tests[@]} -ne 0 ]; then
echo -e "${RED}Failed tests: ${#failed_tests[@]}${NC}"
echo -e "Failed tests are: $(IFS=, ; echo "${failed_tests[*]}" | sed 's/,/, /g')"
exit 1
else
echo -e "${GREEN}Failed tests: 0${NC}"
exit 0
fi