[06/21] tests/lib.sh: adjust to pytest logging style

Message ID 20240520090611.10406-7-jonatan.schlag@ipfire.org
State New
Headers
Series [01/21] test: Add bash lib for colors |

Commit Message

Jonatan Schlag May 20, 2024, 9:05 a.m. UTC
  Black on white is still the best to read. So we only style FAILED or
PASSED in green or red.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
---
 tests/lib.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Michael Tremer May 31, 2024, 9:49 a.m. UTC | #1
Hello,

You are making an assumption that people have a certain background color of their terminal...

> On 20 May 2024, at 10:05, Jonatan Schlag <jonatan.schlag@ipfire.org> wrote:
> 
> Black on white is still the best to read. So we only style FAILED or
> PASSED in green or red.
> 
> Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
> ---
> tests/lib.sh | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/lib.sh b/tests/lib.sh
> index 6483c41c3..079755410 100644
> --- a/tests/lib.sh
> +++ b/tests/lib.sh
> @@ -5,11 +5,11 @@ LIB_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
> . ${LIB_DIR}/lib_color.sh
> 
> log_test_failed(){
> - echo -e "${CLR_RED_BG}Test failed: ${*}${CLR_RESET}'"
> + echo -e "${CLR_RED_R}FAILED:${CLR_RESET} ${*}"
> }
> 
> log_test_succeded(){
> - echo -e "${CLR_GREEN_BG}Test succeded: ${*}${CLR_RESET}"
> + echo -e "${CLR_GREEN_R}PASSED:${CLR_RESET} ${*}"
> }
> 
> test_that() {
> -- 
> 2.39.2
>
  

Patch

diff --git a/tests/lib.sh b/tests/lib.sh
index 6483c41c3..079755410 100644
--- a/tests/lib.sh
+++ b/tests/lib.sh
@@ -5,11 +5,11 @@  LIB_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
 . ${LIB_DIR}/lib_color.sh
 
 log_test_failed(){
-	echo -e "${CLR_RED_BG}Test failed: ${*}${CLR_RESET}'"
+	echo -e "${CLR_RED_R}FAILED:${CLR_RESET} ${*}"
 }
 
 log_test_succeded(){
-	echo -e "${CLR_GREEN_BG}Test succeded: ${*}${CLR_RESET}"
+	echo -e "${CLR_GREEN_R}PASSED:${CLR_RESET} ${*}"
 }
 
 test_that() {