aboutsummaryrefslogtreecommitdiff
path: root/vendor/librune/test/tests
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-01-21 03:03:58 +0100
committerThomas Voss <mail@thomasvoss.com> 2024-01-21 03:03:58 +0100
commit4f93f935dc7a981ca073a322425c3f5929ffb644 (patch)
tree4460586408ec7fdfcecf3ba4584f0435067125a6 /vendor/librune/test/tests
parent72ea25a4d73e3e026366d4165f5bc4ec9e7418cb (diff)
Support line- & column-based match locations
Diffstat (limited to 'vendor/librune/test/tests')
-rwxr-xr-xvendor/librune/test/tests38
1 files changed, 38 insertions, 0 deletions
diff --git a/vendor/librune/test/tests b/vendor/librune/test/tests
new file mode 100755
index 0000000..e728773
--- /dev/null
+++ b/vendor/librune/test/tests
@@ -0,0 +1,38 @@
+#!/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 -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