Skip to content

Commit a45e10f

Browse files
committed
[feat](color option): New option, colored message or not
1 parent 297f4f3 commit a45e10f

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

src/shellunity

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,31 @@ NUMBER_OF_IGNORED_UNITY="0"
2222
FINISHED_ALL_TESTS_UNITY="0"
2323
TEST_IGNORE_UNITY="0"
2424

25+
for PARAM in "$@"
26+
do
27+
case "$1" in
28+
29+
-c | --color)
30+
YELLOW="\033[43m"
31+
GREEN="\033[42m"
32+
RED="\033[41m"
33+
END="\033[m"
34+
;;
35+
36+
-v | --verbose)
37+
## TODO: Implementar modo verbose na shellunity
38+
;;
39+
40+
*)
41+
YELLOW=""
42+
GREEN=""
43+
RED=""
44+
END=""
45+
;;
46+
47+
esac
48+
done
49+
2550
RESULT_UNITY(){
2651

2752
FINISHED_ALL_TESTS_UNITY="1"
@@ -36,7 +61,7 @@ TEST_UNITY(){
3661
NUMBER_OF_TESTS_UNITY=$((NUMBER_OF_TESTS_UNITY+1))
3762
[ "$TEST_IGNORE_UNITY" == "1" ] && {
3863
NUMBER_OF_IGNORED_UNITY=$((NUMBER_OF_IGNORED_UNITY+1))
39-
echo -e "$0:$2:$3:\033[43mIGNORED\033[m"
64+
echo -e "$0:$2:$3:${YELLOW}IGNORED${END}"
4065
return
4166
}
4267

@@ -47,10 +72,10 @@ TEST_UNITY(){
4772

4873
if [ "$1" == "0" ]
4974
then
50-
echo -e "\033[42mPASS\033[m"
75+
echo -e "${GREEN}PASS${END}"
5176
else
5277
NUMBER_OF_FAILURES_UNITY=$((NUMBER_OF_FAILURES_UNITY+1))
53-
echo -e "\033[41mFAIL\033[m"
78+
echo -e "${RED}FAIL${END}"
5479
fi
5580

5681
}

0 commit comments

Comments
 (0)