From f9726d0229e834df11e0a8e903e6c5185a5cffbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Kl=C3=A9ger?= Date: Mon, 13 Oct 2025 19:12:30 +0200 Subject: [PATCH] test: Add --gitlab flag --- test/main.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/test/main.sh b/test/main.sh index 1088439..8c7d234 100755 --- a/test/main.sh +++ b/test/main.sh @@ -7,11 +7,21 @@ GREEN="\e[32m" YELLOW="\e[33m" RESET="\e[0m" -if [[ "$1" =~ --all|-a ]]; then - check_all=true -else - check_all=false -fi +DIFF_COMMAND="diff --color" + +for arg in "$@"; do + case "$arg" in + --all|-a) + check_all=true + ;; + --gitlab|-g) + # Disable colored output, because alpine diff is missing --color flag + DIFF_COMMAND="diff" + ;; + esac +done + + EXIT_STATUS=0 @@ -74,7 +84,7 @@ _test_dir() { input_file=${input//*\/} test_case_number=${input_file%%_in.txt} - if ! diff --color <(./a.out < "test_data/${test_case_number}_in.txt") "test_data/${test_case_number}_out.txt"; then + if ! $DIFF_COMMAND <(./a.out < "test_data/${test_case_number}_in.txt") "test_data/${test_case_number}_out.txt"; then EXIT_STATUS=1 ((failed_inputs++)) _log 2 "$dir (#$test_case_number)"