File: tapdiffer

package info (click to toggle)
cvs-fast-export 1.59-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 5,960 kB
  • sloc: ansic: 5,743; python: 1,391; sh: 532; lex: 352; yacc: 273; makefile: 249; perl: 99
file content (31 lines) | stat: -rwxr-xr-x 627 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#! /bin/sh
#
# tapdiffer - Render diff between input and checkfile as a TAP report
#
# Usage: tapdiffer LEGEND CHECKFILE
#
# Output is a TAP report, ok if the diff is empty and not ok otherwisw.
# A nonempty diff is shipped as a TAP YAML block following "not ok" 
# unless QUIET=1 in the environment.
#
legend=$1
checkfile=$2

trap 'rm /tmp/tapdiff$$' EXIT HUP INT QUIT TERM

if diff --text -u ${checkfile} - >/tmp/tapdiff$$
then
	echo "ok - ${legend}"
	exit 0
else
	echo "not ok - ${checkfile}: ${legend}"
	if [ ! "${QUIET}" = 1 ]
	then
		echo "  --- |"
		sed </tmp/tapdiff$$ -e 's/^/  /'
		echo "  ..."
	fi
	exit 1
fi

# end