about summary refs log tree commit diff
path: root/t/lib.sh
blob: 81c2dd1643baf339555a141466cf79d31647995e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
}