SYNOPSIS

tapdiffer [-b] legend checkfile

DESCRIPTION

This utility is a TAP producer that compares standard input with a specified checkfile. The output begins with an unnunbered TAP report line in which the checkfile and legend arguments specify the text part.

If the diff is empty the report is a solitary "ok" line. If the diff is nonempty it the report is a "not ok" line followed by the diff in the format of a TAP14 YAML attachment. If the environment variable QUIET is nonempty the YAML section is suppressed.

The -b option, if present, instructs the diff utility to ignore trailing whitespace and trat all runs of whitespace within a line as equivalent to a single space.

A typical Makefile snippet to invoke this on a set of log (.log) and checkfile (.chk) pairs. testing a filter named by FILTER, mivght look like this:

TESTLOADS := $(shell ls *.log | sed '/.log/s///')
tap:
	echo "1..$$(ls *.log | wc -l)"
	@for test in $(TESTLOADS); \
	do \
		legend=$$(sed -n -e '/^## /s///p' <$${test}.log); \
		$(FILTER) <"$${test}.log" | ./tapdiffer "$${legend}" "$${test}.chk"; \
	done

check:
	$(MAKE) tap | tapview

REQUIREMENTS

tapdiffer is written in pure POSIX shell. It requires a version of diff(1) that acceps the -u and -b options, such as GNU diff. There are no other dependencies.

ERROR RETURNS

Alwqys returns 0.

AUTHOR

Eric S. Raymond <esr@thyrsus.com>. The public repository is at on GitLab.