From 79e6af86ca526d5fb56af6f6ca3da713e3a5e9f9 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Tue, 13 Feb 2024 13:02:28 +0100 Subject: Genesis commit --- vendor/librune/test/tests | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 vendor/librune/test/tests (limited to 'vendor/librune/test/tests') diff --git a/vendor/librune/test/tests b/vendor/librune/test/tests new file mode 100755 index 0000000..5affe3a --- /dev/null +++ b/vendor/librune/test/tests @@ -0,0 +1,39 @@ +#!/bin/sh + +report() +{ + case $1 in + 0) printf 'All tests passed\n' >&2 ;; + 1) printf '1 test failed\n' >&2 ;; + *) printf '%d tests failed\n' $1 >&2 + esac +} + +readonly src=../data/GraphemeBreakTest.txt + +set -e +cd "${0%/*}" +find ../lib -name '*.c' -exec \ + cc -std=c2x -Wno-attributes -I../include -o gbrk gbrk.c {} + +trap 'rm -f gbrk' EXIT + +n=$( + ./gbrk $src \ + | diff -y --suppress-common-lines $src - \ + | tee failures \ + | wc -l +) +test $n -eq 0 && rm failures + +if test -t 2 +then + case $n in + 0) printf '\033[0;32m' ;; + *) printf '\033[0;31m' + esac + + report $n + printf '\033[0m' >&2 +else + report $n +fi -- cgit v1.2.3