diff --git a/unitests.sh b/unitests.sh index 226691d..017052d 100644 --- a/unitests.sh +++ b/unitests.sh @@ -181,11 +181,12 @@ cd $(dirname $0) } # compare the execution output and mark and print the success or failure -# receive parameters : $1 bash execution output, $2 minishell execution output +# receive parameters : $1 bash execution output, $2 minishell execution output, $3 commands function compare_output { bash_output="$1" minishell_output="$2" + sent_commands="$3" if [ "$bash_output" = "$minishell_output" ] then (( SUCCESS_TEST++ )) @@ -195,12 +196,12 @@ cd $(dirname $0) if [ $PRINT -eq 1 ] then failure_cmd="FAILURE line $(( $LINE_NUMBER - 1 )), command : " - print_command "$failure_cmd" "$@" "$MAGENTA" + print_command "$failure_cmd" "$3" "$MAGENTA" fi # print simple log - echo -e $B_WHITE"\n\n$@\n-----------"$ENDCO >>$BASH_LOG + echo -e $B_WHITE"\n\n$3\n-----------"$ENDCO >>$BASH_LOG echo "$bash_output" >> $BASH_LOG - echo -e $B_WHITE"\n\n$@\n-----------"$ENDCO >>$MINISHELL_LOG + echo -e $B_WHITE"\n\n$3\n-----------"$ENDCO >>$MINISHELL_LOG echo "$minishell_output" >> $MINISHELL_LOG fi } @@ -288,7 +289,7 @@ cd $(dirname $0) minishell_execution="$( echo "$minishell_execution" | sort | grep -v -e "LINES=" -e "COLUMNS=" -e "_=" -e"LESSCLOSE=" -e "LESSOPEN=" )" fi - compare_output "$bash_execution" "$minishell_execution" + compare_output "$bash_execution" "$minishell_execution" "$commands" } # function to print the results