Partial REUSE cmpliance.
[open-adventure.git] / tests / tapdiffer
index b529a3931fb55fbf9d642b70103883658aef78c6..98df500fadbc5e0a83b0189c4206c0b39299884a 100755 (executable)
@@ -1,4 +1,6 @@
 #! /bin/sh
+# SPDX-FileCopyrightText: Eric S. Raymond
+# SPDX-License-Identifier: BSD-2-Clause
 #
 # tapdiffer - Render diff between input and checkfile as a TAP report
 #
 # A nonempty diff is shipped as a TAP YAML block following "not ok" 
 # unless QUIET=1 in the environment.
 #
+if [ "$1" = "-w" ]
+then
+    diffopts=-ubZ
+    shift
+else
+    diffopts=-u
+fi
+
 legend=$1
 checkfile=$2
 
 trap 'rm /tmp/tapdiff$$' EXIT HUP INT QUIT TERM
 
-if diff --text -u ${checkfile} - >/tmp/tapdiff$$
+if diff --text "${diffopts}" ${checkfile} - >/tmp/tapdiff$$
 then
        echo "ok - ${legend}"
-       exit 0
 else
        echo "not ok - ${checkfile}: ${legend}"
        if [ ! "${QUIET}" = 1 ]
@@ -25,7 +34,6 @@ else
                sed </tmp/tapdiff$$ -e 's/^/  /'
                echo "  ..."
        fi
-       exit 1
 fi
 
 # end