diff options
author | Malfurious <m@lfurio.us> | 2021-08-23 07:35:24 -0400 |
---|---|---|
committer | Malfurious <m@lfurio.us> | 2021-08-23 07:35:24 -0400 |
commit | 0175c1c40f9567a401a986d85ab6d6f5365eec7a (patch) | |
tree | 6e631a29735ab0c5ca0f1650934da3a24eecff62 /test/shunit/shunit2_test_macros.sh | |
parent | 6c08d333a74aacd1fa9d14de9abab38ede4a8e88 (diff) | |
download | git-sonar-0175c1c40f9567a401a986d85ab6d6f5365eec7a.tar.gz git-sonar-0175c1c40f9567a401a986d85ab6d6f5365eec7a.zip |
Remove unit tests
I don't particularly wish to maintain these tests for a few reasons:
* Many of them make assertions strictly about rendered text / UI
* Many of them test external systems and touch the disk
* There are platform-dependent details that complicate several
tests.
So, the tests are removed. Ideally, the main script is reworked into
something simple enough it doesn't necessarily warrant heavy testing.
Signed-off-by: Malfurious <m@lfurio.us>
Diffstat (limited to 'test/shunit/shunit2_test_macros.sh')
-rwxr-xr-x | test/shunit/shunit2_test_macros.sh | 249 |
1 files changed, 0 insertions, 249 deletions
diff --git a/test/shunit/shunit2_test_macros.sh b/test/shunit/shunit2_test_macros.sh deleted file mode 100755 index 94fdbed..0000000 --- a/test/shunit/shunit2_test_macros.sh +++ /dev/null @@ -1,249 +0,0 @@ -#! /bin/sh -# $Id: shunit2_test_macros.sh 299 2010-05-03 12:44:20Z kate.ward@forestent.com $ -# vim:et:ft=sh:sts=2:sw=2 -# -# Copyright 2008 Kate Ward. All Rights Reserved. -# Released under the LGPL (GNU Lesser General Public License) -# Author: kate.ward@forestent.com (Kate Ward) -# -# shUnit2 unit test for macros. - -# load test helpers -. ./shunit2_test_helpers - -#------------------------------------------------------------------------------ -# suite tests -# - -testAssertEquals() -{ - # start skipping if LINENO not available - [ -z "${LINENO:-}" ] && startSkipping - - ( ${_ASSERT_EQUALS_} 'x' 'y' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null - rtrn=$? - assertTrue '_ASSERT_EQUALS_ failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 - - ( ${_ASSERT_EQUALS_} '"some msg"' 'x' 'y' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null - rtrn=$? - assertTrue '_ASSERT_EQUALS_ w/ msg failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 -} - -testAssertNotEquals() -{ - # start skipping if LINENO not available - [ -z "${LINENO:-}" ] && startSkipping - - ( ${_ASSERT_NOT_EQUALS_} 'x' 'x' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null - rtrn=$? - assertTrue '_ASSERT_NOT_EQUALS_ failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 - - ( ${_ASSERT_NOT_EQUALS_} '"some msg"' 'x' 'x' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null - rtrn=$? - assertTrue '_ASSERT_NOT_EQUALS_ w/ msg failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 -} - -testSame() -{ - # start skipping if LINENO not available - [ -z "${LINENO:-}" ] && startSkipping - - ( ${_ASSERT_SAME_} 'x' 'y' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null - rtrn=$? - assertTrue '_ASSERT_SAME_ failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 - - ( ${_ASSERT_SAME_} '"some msg"' 'x' 'y' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null - rtrn=$? - assertTrue '_ASSERT_SAME_ w/ msg failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 -} - -testNotSame() -{ - # start skipping if LINENO not available - [ -z "${LINENO:-}" ] && startSkipping - - ( ${_ASSERT_NOT_SAME_} 'x' 'x' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null - rtrn=$? - assertTrue '_ASSERT_NOT_SAME_ failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 - - ( ${_ASSERT_NOT_SAME_} '"some msg"' 'x' 'x' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null - rtrn=$? - assertTrue '_ASSERT_NOT_SAME_ w/ msg failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 -} - -testNull() -{ - # start skipping if LINENO not available - [ -z "${LINENO:-}" ] && startSkipping - - ( ${_ASSERT_NULL_} 'x' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null - rtrn=$? - assertTrue '_ASSERT_NULL_ failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 - - ( ${_ASSERT_NULL_} '"some msg"' 'x' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null - rtrn=$? - assertTrue '_ASSERT_NULL_ w/ msg failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 -} - -testNotNull() -{ - # start skipping if LINENO not available - [ -z "${LINENO:-}" ] && startSkipping - - ( ${_ASSERT_NOT_NULL_} '' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null - rtrn=$? - assertTrue '_ASSERT_NOT_NULL_ failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 - - ( ${_ASSERT_NOT_NULL_} '"some msg"' '""' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null - rtrn=$? - assertTrue '_ASSERT_NOT_NULL_ w/ msg failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stdoutF}" "${stderrF}" >&2 -} - -testAssertTrue() -{ - # start skipping if LINENO not available - [ -z "${LINENO:-}" ] && startSkipping - - ( ${_ASSERT_TRUE_} ${SHUNIT_FALSE} >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null - rtrn=$? - assertTrue '_ASSERT_TRUE_ failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 - - - ( ${_ASSERT_TRUE_} '"some msg"' ${SHUNIT_FALSE} >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null - rtrn=$? - assertTrue '_ASSERT_TRUE_ w/ msg failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 -} - -testAssertFalse() -{ - # start skipping if LINENO not available - [ -z "${LINENO:-}" ] && startSkipping - - ( ${_ASSERT_FALSE_} ${SHUNIT_TRUE} >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null - rtrn=$? - assertTrue '_ASSERT_FALSE_ failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 - - ( ${_ASSERT_FALSE_} '"some msg"' ${SHUNIT_TRUE} >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null - rtrn=$? - assertTrue '_ASSERT_FALSE_ w/ msg failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 -} - -testFail() -{ - # start skipping if LINENO not available - [ -z "${LINENO:-}" ] && startSkipping - - ( ${_FAIL_} >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null - rtrn=$? - assertTrue '_FAIL_ failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 - - ( ${_FAIL_} '"some msg"' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null - rtrn=$? - assertTrue '_FAIL_ w/ msg failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 -} - -testFailNotEquals() -{ - # start skipping if LINENO not available - [ -z "${LINENO:-}" ] && startSkipping - - ( ${_FAIL_NOT_EQUALS_} 'x' 'y' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null - rtrn=$? - assertTrue '_FAIL_NOT_EQUALS_ failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 - - ( ${_FAIL_NOT_EQUALS_} '"some msg"' 'x' 'y' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null - rtrn=$? - assertTrue '_FAIL_NOT_EQUALS_ w/ msg failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 -} - -testFailSame() -{ - # start skipping if LINENO not available - [ -z "${LINENO:-}" ] && startSkipping - - ( ${_FAIL_SAME_} 'x' 'x' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null - rtrn=$? - assertTrue '_FAIL_SAME_ failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 - - ( ${_FAIL_SAME_} '"some msg"' 'x' 'x' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null - rtrn=$? - assertTrue '_FAIL_SAME_ w/ msg failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 -} - -testFailNotSame() -{ - # start skipping if LINENO not available - [ -z "${LINENO:-}" ] && startSkipping - - ( ${_FAIL_NOT_SAME_} 'x' 'y' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null - rtrn=$? - assertTrue '_FAIL_NOT_SAME_ failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 - - ( ${_FAIL_NOT_SAME_} '"some msg"' 'x' 'y' >"${stdoutF}" 2>"${stderrF}" ) - grep '^ASSERT:\[[0-9]*\] *' "${stdoutF}" >/dev/null - rtrn=$? - assertTrue '_FAIL_NOT_SAME_ w/ msg failure' ${rtrn} - [ ${rtrn} -ne ${SHUNIT_TRUE} ] && cat "${stderrF}" >&2 -} - -#------------------------------------------------------------------------------ -# suite functions -# - -oneTimeSetUp() -{ - tmpDir="${__shunit_tmpDir}/output" - mkdir "${tmpDir}" - stdoutF="${tmpDir}/stdout" - stderrF="${tmpDir}/stderr" -} - -# load and run shUnit2 -[ -n "${ZSH_VERSION:-}" ] && SHUNIT_PARENT=$0 -. ${TH_SHUNIT} |