Update tapview and tapdiffer.
This commit is contained in:
parent
f26514b5dd
commit
3c09c25cc3
2 changed files with 29 additions and 17 deletions
|
@ -1,6 +1,4 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
|
|
||||||
# SPDX-License-Identifier: MIT-0
|
|
||||||
#
|
#
|
||||||
# tapdiffer - Render diff between input and checkfile as a TAP report
|
# tapdiffer - Render diff between input and checkfile as a TAP report
|
||||||
#
|
#
|
||||||
|
@ -16,17 +14,23 @@
|
||||||
# OSD-compliant; otherwise the following SPDX tag incorporates the
|
# OSD-compliant; otherwise the following SPDX tag incorporates the
|
||||||
# MIT No Attribution license by reference.
|
# MIT No Attribution license by reference.
|
||||||
#
|
#
|
||||||
|
# SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
|
||||||
|
# SPDX-License-Identifier: MIT-0
|
||||||
|
#
|
||||||
# A newer version may be available at https://gitlab.com/esr/tapview
|
# A newer version may be available at https://gitlab.com/esr/tapview
|
||||||
# Check your last commit dqte for this file against the commit list
|
# Check your last commit dqte for this file against the commit list
|
||||||
# there to see if it might be a good idea to update.
|
# there to see if it might be a good idea to update.
|
||||||
#
|
#
|
||||||
if [ "$1" = "-b" ]
|
|
||||||
then
|
|
||||||
diffopts=-ub
|
|
||||||
shift
|
|
||||||
else
|
|
||||||
diffopts=-u
|
diffopts=-u
|
||||||
fi
|
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
|
legend=$1
|
||||||
checkfile=$2
|
checkfile=$2
|
||||||
|
@ -37,7 +41,7 @@ if diff --text "${diffopts}" "${checkfile}" - >/tmp/tapdiff$$
|
||||||
then
|
then
|
||||||
echo "ok - ${legend}"
|
echo "ok - ${legend}"
|
||||||
else
|
else
|
||||||
echo "not ok - ${checkfile}: ${legend}"
|
echo "not ok - ${legend}"
|
||||||
if [ ! "${QUIET}" = 1 ]
|
if [ ! "${QUIET}" = 1 ]
|
||||||
then
|
then
|
||||||
echo " --- |"
|
echo " --- |"
|
||||||
|
|
|
@ -4,14 +4,15 @@
|
||||||
# This code is intended to be embedded in your project. The author
|
# This code is intended to be embedded in your project. The author
|
||||||
# grants permission for it to be distributed under the prevailing
|
# grants permission for it to be distributed under the prevailing
|
||||||
# license of your project if you choose, provided that license is
|
# license of your project if you choose, provided that license is
|
||||||
# OSD-compliant; otherwise the following SPDX tag incorporates a
|
# OSD-compliant; otherwise the following SPDX tag incorporates the
|
||||||
# license by reference.
|
# MIT No Attribution license by reference.
|
||||||
#
|
#
|
||||||
# SPDX-FileCopyrightText: Copyright Eric S. Raymond <esr@thyrsus.com>
|
# SPDX-FileCopyrightText: (C) Eric S. Raymond <esr@thyrsus.com>
|
||||||
# SPDX-License-Identifier: BSD-2-Clause
|
# SPDX-License-Identifier: MIT-0
|
||||||
#
|
#
|
||||||
# This is version 1.6
|
|
||||||
# A newer version may be available at https://gitlab.com/esr/tapview
|
# A newer version may be available at https://gitlab.com/esr/tapview
|
||||||
|
# Check your last commit date for this file against the commit list
|
||||||
|
# there to see if it might be a good idea to update.
|
||||||
#
|
#
|
||||||
OK="."
|
OK="."
|
||||||
FAIL="F"
|
FAIL="F"
|
||||||
|
@ -19,13 +20,16 @@ SKIP="s"
|
||||||
TODO_NOT_OK="x"
|
TODO_NOT_OK="x"
|
||||||
TODO_OK="u"
|
TODO_OK="u"
|
||||||
|
|
||||||
|
LF='
|
||||||
|
'
|
||||||
|
|
||||||
ship_char() {
|
ship_char() {
|
||||||
# shellcheck disable=SC2039
|
# shellcheck disable=SC2039
|
||||||
printf '%s' "$1" # https://www.etalabs.net/sh_tricks.html
|
printf '%s' "$1" # https://www.etalabs.net/sh_tricks.html
|
||||||
}
|
}
|
||||||
|
|
||||||
ship_line() {
|
ship_line() {
|
||||||
report="${report}${1}\n"
|
report="${report}${1}$LF"
|
||||||
}
|
}
|
||||||
|
|
||||||
ship_error() {
|
ship_error() {
|
||||||
|
@ -34,7 +38,7 @@ ship_error() {
|
||||||
then
|
then
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
report="${report}${1}\n"
|
report="${report}${1}$LF"
|
||||||
echo "${report}"
|
echo "${report}"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
@ -76,6 +80,10 @@ context_pop () {
|
||||||
then
|
then
|
||||||
ship_line "Expected $(context_get expect) tests but only ${testcount} ran."
|
ship_line "Expected $(context_get expect) tests but only ${testcount} ran."
|
||||||
status=1
|
status=1
|
||||||
|
elif [ "$(context_get plan)" != "" ] && [ "$(context_get expect)" -lt "$(context_get count)" ]
|
||||||
|
then
|
||||||
|
ship_line "${testcount} ran but $(context_get expect) expected."
|
||||||
|
status=1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue