X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=tests%2Ftapdiffer;h=ea1cfa7041f5ca004f8edb737ea2c533da6b200d;hb=HEAD;hp=98df500fadbc5e0a83b0189c4206c0b39299884a;hpb=25230068fe3afb9d1faa9c606413784294700cef;p=open-adventure.git diff --git a/tests/tapdiffer b/tests/tapdiffer index 98df500..ea1cfa7 100755 --- a/tests/tapdiffer +++ b/tests/tapdiffer @@ -1,6 +1,4 @@ #! /bin/sh -# SPDX-FileCopyrightText: Eric S. Raymond -# SPDX-License-Identifier: BSD-2-Clause # # tapdiffer - Render diff between input and checkfile as a TAP report # @@ -10,24 +8,40 @@ # 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 +# This code is intended to be embedded in your project. The author +# grants permission for it to be distributed under the prevailing +# license of your project if you choose, provided that license is +# OSD-compliant; otherwise the following SPDX tag incorporates the +# MIT No Attribution license by reference. +# +# SPDX-FileCopyrightText: (C) Eric S. Raymond +# SPDX-License-Identifier: MIT-0 +# +# A newer version may be available at https://gitlab.com/esr/tapview +# Check your last commit dqte for this file against the commit list +# there to see if it might be a good idea to update. +# +diffopts=-u +while getopts bn opt +do + case $opt in + b) diffopts=-ub;; + *) echo "tapdiffer: unknown option ${opt}."; exit 1;; + esac +done +# shellcheck disable=SC2004 +shift $(($OPTIND - 1)) legend=$1 checkfile=$2 trap 'rm /tmp/tapdiff$$' EXIT HUP INT QUIT TERM -if diff --text "${diffopts}" ${checkfile} - >/tmp/tapdiff$$ +if diff --text "${diffopts}" "${checkfile}" - >/tmp/tapdiff$$ then echo "ok - ${legend}" else - echo "not ok - ${checkfile}: ${legend}" + echo "not ok - ${legend}" if [ ! "${QUIET}" = 1 ] then echo " --- |"