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 unnumbered 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 treat 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, might 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 accepts the -u and -b options, such as GNU diff. There are no other dependencies.

BUGS

This tool relies on diff -u and -a options that are not mandated by POSIX. If it crashes for this reason, removing them from the copies you embed in your projects will produce less useful output but still be usable

ERROR RETURNS

Always returns 0.

AUTHOR

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