gt: tests: Add colours for OK and FAILED
authorKrzysztof Opasiak <k.opasiak@samsung.com>
Wed, 27 Aug 2014 12:41:57 +0000 (14:41 +0200)
committerKrzysztof Opasiak <k.opasiak@samsung.com>
Wed, 27 Aug 2014 12:41:57 +0000 (14:41 +0200)
Change-Id: If2c45fbe2002aeedf58e4fb942cdd5696fb65c3e
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
source/test.bash

index a83b2dd..2b2a39e 100755 (executable)
@@ -26,27 +26,27 @@ SUCCESS_COUNT=0;
 function expect_success {
        if ! $GT $1 > test.out; then
                ERROR_COUNT=$((ERROR_COUNT + 1));
-               echo "[FAILED] gt $1 -- gt failed";
+               echo "$(tput setaf 1)[FAILED]$(tput sgr0) gt $1 -- gt failed";
        elif ! diff -w <(tail -n+2 test.out) <(echo "$2") &> /dev/null; then
                ERROR_COUNT=$((ERROR_COUNT + 1));
-               echo "[FAILED] gt $1 -- unexpected output";
+               echo "$(tput setaf 1)[FAILED]$(tput sgr0) gt $1 -- unexpected output";
                echo "Expected:";
                echo "$2";
                echo "Got: ";
                tail -n+2 test.out;
        else
                SUCCESS_COUNT=$((SUCCESS_COUNT + 1));
-               echo "[OK] gt $1 -- succeed";
+               echo "$(tput setaf 2)[OK]$(tput sgr0) gt $1 -- succeed";
        fi
 }
 
 function expect_failure {
        if $GT $1 &> /dev/null; then
                ERROR_COUNT=$((ERROR_COUNT + 1));
-               echo "[FAILED] gt $1 -- expected failure";
+               echo "$(tput setaf 1)[FAILED]$(tput sgr0) gt $1 -- expected failure";
        else
                SUCCESS_COUNT=$((SUCCESS_COUNT + 1));
-               echo "[OK] gt $1 -- failed as expected";
+               echo "$(tput setaf 2)[OK]$(tput sgr0) gt $1 -- failed as expected";
        fi
 
 }