2 # SPDX-FileCopyrightText: Eric S. Raymond <esr@thyrsus.com>
3 # SPDX-License-Identifier: MIT-0
5 # tapdiffer - Render diff between input and checkfile as a TAP report
7 # Usage: tapdiffer LEGEND CHECKFILE
9 # Output is a TAP report, ok if the diff is empty and not ok otherwise.
10 # A nonempty diff is shipped as a TAP YAML block following "not ok"
11 # unless QUIET=1 in the environment.
13 # This code is intended to be embedded in your project. The author
14 # grants permission for it to be distributed under the prevailing
15 # license of your project if you choose, provided that license is
16 # OSD-compliant; otherwise the following SPDX tag incorporates the
17 # MIT No Attribution license by reference.
19 # A newer version may be available at https://gitlab.com/esr/tapview
20 # Check your last commit dqte for this file against the commit list
21 # there to see if it might be a good idea to update.
34 trap 'rm /tmp/tapdiff$$' EXIT HUP INT QUIT TERM
36 if diff --text "${diffopts}" "${checkfile}" - >/tmp/tapdiff$$
40 echo "not ok - ${checkfile}: ${legend}"
41 if [ ! "${QUIET}" = 1 ]
44 sed </tmp/tapdiff$$ -e 's/^/ /'