summary refs log tree commit diff
path: root/t/lib.sh
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-03-30 15:46:47 +0200
committerLeah Neukirchen <leah@vuxu.org>2017-03-30 15:46:47 +0200
commit2c1ecbe4a678963e6b1619e1703748ec116a8fcd (patch)
tree0d6fc42fc00b95f052f450b69e65afc6492b63f7 /t/lib.sh
parentd73a3a748aaaf1a6da2b35815b909571bc38d290 (diff)
downloadmblaze-2c1ecbe4a678963e6b1619e1703748ec116a8fcd.tar.gz
mblaze-2c1ecbe4a678963e6b1619e1703748ec116a8fcd.tar.xz
mblaze-2c1ecbe4a678963e6b1619e1703748ec116a8fcd.zip
t: beginnings of a test suite
Diffstat (limited to 't/lib.sh')
-rw-r--r--t/lib.sh24
1 files changed, 24 insertions, 0 deletions
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
+}