turn off green color after printing OK

master
Alexander Tomokhov 2023-12-12 12:40:43 +04:00
parent be7e7b086d
commit 2d6abb037c
4 changed files with 5 additions and 6 deletions

View File

@ -71,7 +71,7 @@ jq <<<"$sorted_response"
if diff -w -u --color <(printf "%s\n" "$EXPECTED_RESPONSE") <(printf "%s\n" "$sorted_response") 2>/dev/null if diff -w -u --color <(printf "%s\n" "$EXPECTED_RESPONSE") <(printf "%s\n" "$sorted_response") 2>/dev/null
then then
echo -e "\e[1;32mOK" echo -e "\e[1;32mOK\e[0m"
else else
echo -e "\e[1;31mFAIL: response does not match!" echo -e "\e[1;31mFAIL: response does not match!"
jd -color <(printf "%s\n" "$EXPECTED_RESPONSE") <(printf "%s" "$sorted_response") jd -color <(printf "%s\n" "$EXPECTED_RESPONSE") <(printf "%s" "$sorted_response")

View File

@ -58,7 +58,7 @@ jq <<<"$sorted_response"
if diff -w -u --color <(printf "%s\n" "$EXPECTED_RESPONSE") <(printf "%s\n" "$sorted_response") 2>/dev/null if diff -w -u --color <(printf "%s\n" "$EXPECTED_RESPONSE") <(printf "%s\n" "$sorted_response") 2>/dev/null
then then
echo -e "\e[1;32mOK" echo -e "\e[1;32mOK\e[0m"
else else
echo -e "\e[1;31mFAIL: response does not match!" echo -e "\e[1;31mFAIL: response does not match!"
jd -color <(printf "%s\n" "$EXPECTED_RESPONSE") <(printf "%s" "$sorted_response") jd -color <(printf "%s\n" "$EXPECTED_RESPONSE") <(printf "%s" "$sorted_response")

View File

@ -39,7 +39,7 @@ jq <<<"$received_response"
if diff -w -u --color "$EXPECTED_RESPONSE_FILE" <(printf "%s\n" "$received_response") 2>/dev/null if diff -w -u --color "$EXPECTED_RESPONSE_FILE" <(printf "%s\n" "$received_response") 2>/dev/null
then then
echo -e "\e[1;32mOK" echo -e "\e[1;32mOK\e[0m"
else else
echo -e "\e[1;31mFAIL: response does not match!" echo -e "\e[1;31mFAIL: response does not match!"
jd -color "$EXPECTED_RESPONSE_FILE" <(printf "%s" "$received_response") jd -color "$EXPECTED_RESPONSE_FILE" <(printf "%s" "$received_response")

View File

@ -4,7 +4,7 @@ set -o pipefail
set -o errexit set -o errexit
set -o nounset set -o nounset
: ${DOMAIN:?specify domain name} : "${DOMAIN:?specify domain name}"
EXPECTED_RESPONSE="[]" EXPECTED_RESPONSE="[]"
received_response="$(\ received_response="$(\
@ -15,7 +15,7 @@ jq . <(printf "%s" "$received_response")
if diff --color <(printf "%s\n" "$EXPECTED_RESPONSE") <(printf "%s\n" "$received_response") 2>/dev/null if diff --color <(printf "%s\n" "$EXPECTED_RESPONSE") <(printf "%s\n" "$received_response") 2>/dev/null
then then
echo -e "\e[1;32mOK" echo -e "\e[1;32mOK\e[0m"
else else
echo -e "\e[1;31mFAIL: response does not match!" echo -e "\e[1;31mFAIL: response does not match!"
if type jd > /dev/null; then if type jd > /dev/null; then
@ -26,4 +26,3 @@ else
fi fi
exit 1 exit 1
fi fi