From 2c1ecbe4a678963e6b1619e1703748ec116a8fcd Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Thu, 30 Mar 2017 15:46:47 +0200 Subject: t: beginnings of a test suite --- t/lib.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 t/lib.sh (limited to 't/lib.sh') diff --git a/t/lib.sh b/t/lib.sh new file mode 100644 index 0000000..81c2dd1 --- /dev/null +++ b/t/lib.sh @@ -0,0 +1,24 @@ +plan() { + printf '1..%d\n' "$1" +} + +check() { + msg=$1 + shift + if eval "$@" 2>/dev/null 1>&2; then + printf 'ok - %s\n' "$msg" + else + printf 'not ok - %s\n' "$msg" + false + fi + true +} + +check_same() { + msg=$1 + shift + eval "$1" 2>/dev/null 1>&2 >out1 || true + eval "$2" 2>/dev/null 1>&2 >out2 || true + diff -u out1 out2 || true + check "$msg" cmp out1 out2 +} -- cgit 1.4.1