From: Mischa POSLAWSKY Date: Tue, 10 Sep 2019 19:50:49 +0000 (+0200) Subject: t: colorize results on tty output X-Git-Tag: v1.06~19 X-Git-Url: http://git.shiar.nl/barcat.git/commitdiff_plain/2f41dadf7f9a08522a7e84cfd28f847fd1428366 t: colorize results on tty output --- diff --git a/t/regress.t b/t/regress.t index 84f3c99..b8d05dd 100755 --- a/t/regress.t +++ b/t/regress.t @@ -6,10 +6,16 @@ test_count=0 fail_count=0 COLUMNS=40 +colorize= +test -t 1 && colorize=1 +color () { + test -n "$colorize" && + printf '\e[%sm' $@ +} regenerate= diffcmd () { comm --nocheck-order --output-delimiter=::: -3 $@ | - perl -pe'END{exit !!$.} s/^:::/>/ || s/^// || s/^/$(color 32)0)) +color 0 +exit $fail_count