diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-04-21 23:37:27 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2019-04-21 23:37:27 (EDT) |
commit | 76885ce7f12b98f0700a3a0535e06425bc1a9aa5 (patch) | |
tree | d3c59eed4e2af1a88b7a6cc7c06f1eee6c4e6110 /tests/common.sh | |
parent | fef7ed43edfbde6c6536bea88d6b56c1f27fe0e0 (diff) |
tests/common.sh: Remove newly unused file
Diffstat (limited to 'tests/common.sh')
-rw-r--r-- | tests/common.sh | 110 |
1 files changed, 0 insertions, 110 deletions
diff --git a/tests/common.sh b/tests/common.sh deleted file mode 100644 index 293dc7d..0000000 --- a/tests/common.sh +++ /dev/null @@ -1,110 +0,0 @@ -# Common testsuite functions -# -# Copyright (C) 2013, 2014 Patrick "P. J." McDermott -# -# This file is part of the ProteanOS Development Kit. -# -# The ProteanOS Development Kit is free software: you can redistribute -# it and/or modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# The ProteanOS Development Kit is distributed in the hope that it -# will be useful, but WITHOUT ANY WARRANTY; without even the implied -# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with the ProteanOS Development Kit. If not, see -# <http://www.gnu.org/licenses/>. - -tests_es=0 -atexit() -{ - local es=${?} - - if [ ${es} -ne 0 ]; then - exit ${es} - else - exit ${tests_es} - fi -} -trap atexit EXIT - -in_place=true -builddir='.' - -assert() -{ - if ! eval "${@}"; then - warn 'Assertion failed: %s\n' "${*}" - tests_es=1 - fi -} - -if [ "x${COLOR_TEST_LOGS:-no}" = 'xno' ]; then - red= grn= lgn= blu= mgn= std= -else - red='[0;31m' # Red. - grn='[0;32m' # Green. - lgn='[1;32m' # Light green. - blu='[1;34m' # Blue. - mgn='[0;35m' # Magenta. - std='[m' # No color. -fi - -test_diff() -{ - local good_results="${1}" - local test_results="${2}" - local line_no= - local errors= - local good_line= - local test_line= - local line= - - printf 'Diff:\n' - exec 3<<-EOF - ${good_results} - EOF - exec 4<<-EOF - ${test_results} - EOF - line_no=0 - while :; do - line_no=$(($line_no + 1)) - errors=0 - read -r good_line <&3 || errors=$(($errors + 1)) - read -r test_line <&4 || errors=$(($errors + 1)) - [ ${errors} -eq 2 ] && break - if [ "x${good_line}" = "x${test_line}" ]; then - printf '%3d %s\n' ${line_no} "${good_line}" - else - printf '%3d %s-%s%s\n' ${line_no} "${red}" \ - "${good_line}" "${std}" - printf '%3d %s+%s%s\n' ${line_no} "${grn}" \ - "${test_line}" "${std}" - tests_es=1 - fi - done - exec 3<&- - exec 4<&- - - printf '\nExpected results:\n' - line_no=0 - while read -r line; do - line_no=$(($line_no + 1)) - printf '%3d %s\n' ${line_no} "${line}" - done <<-EOF - ${good_results} - EOF - printf '\nTest results:\n' - line_no=0 - while read -r line; do - line_no=$(($line_no + 1)) - printf '%3d %s\n' ${line_no} "${line}" - done <<-EOF - ${test_results} - EOF - printf '\n' -} |