Skip to content

Commit 9dcbf8c

Browse files
committed
[feat](verbose e params): Correct parameters reading and add verbose option
1 parent a45e10f commit 9dcbf8c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/shellunity

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ TEST_IGNORE_UNITY="0"
2424

2525
for PARAM in "$@"
2626
do
27-
case "$1" in
27+
case "$PARAM" in
2828

2929
-c | --color)
3030
YELLOW="\033[43m"
@@ -34,7 +34,7 @@ do
3434
;;
3535

3636
-v | --verbose)
37-
## TODO: Implementar modo verbose na shellunity
37+
VERBOSE="1"
3838
;;
3939

4040
*)
@@ -75,7 +75,13 @@ TEST_UNITY(){
7575
echo -e "${GREEN}PASS${END}"
7676
else
7777
NUMBER_OF_FAILURES_UNITY=$((NUMBER_OF_FAILURES_UNITY+1))
78-
echo -e "${RED}FAIL${END}"
78+
if [ "$VERBOSE" == "1" ]
79+
then
80+
echo -e "${RED}FAIL${END}: $4"
81+
else
82+
echo -e "${RED}FAIL${END}"
83+
fi
84+
7985
fi
8086

8187
}
@@ -121,7 +127,8 @@ TEST_PASS_MESSAGE(){
121127
TEST_ASSERT_EQUAL(){
122128

123129
CONDITION=$(echo "$1==$2" | bc -l)
124-
[ "$CONDITION" == "1" ] && TEST_UNITY 0 "$BASH_LINENO" "$FUNCNAME" || TEST_UNITY 1 "$BASH_LINENO" "$FUNCNAME"
130+
[ "$CONDITION" == "1" ] && TEST_UNITY 0 "$BASH_LINENO" "$FUNCNAME" ||
131+
TEST_UNITY 1 "$BASH_LINENO" "$FUNCNAME" "Expected $1 Was $2"
125132
}
126133

127134
TEST_ASSERT_NOT_EQUAL(){

0 commit comments

Comments
 (0)