Skip to content

Instantly share code, notes, and snippets.

@abathur
Last active May 30, 2022 04:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abathur/0a7a553f482b339d844ef768133b7028 to your computer and use it in GitHub Desktop.
Save abathur/0a7a553f482b339d844ef768133b7028 to your computer and use it in GitHub Desktop.
--- /nix/store/1nqnzfqzxsxrwafksffj78w48jc1iah8-shunit2-2.1.8/bin/shunit2 1969-12-31 18:00:01.000000000 -0600
+++ /nix/store/zh0ac2n6wyff2kpxc32wai8szhj4mk8z-resholved-shunit2-2.1.8/bin/shunit2 1969-12-31 18:00:01.000000000 -0600
@@ -29,15 +29,15 @@
# Logging functions.
_shunit_warn() {
- ${__SHUNIT_CMD_ECHO_ESC} \
+ echo -e \
"${__shunit_ansi_yellow}shunit2:WARN${__shunit_ansi_none} $*" >&2
}
_shunit_error() {
- ${__SHUNIT_CMD_ECHO_ESC} \
+ echo -e \
"${__shunit_ansi_red}shunit2:ERROR${__shunit_ansi_none} $*" >&2
}
_shunit_fatal() {
- ${__SHUNIT_CMD_ECHO_ESC} \
+ echo -e \
"${__shunit_ansi_red}shunit2:FATAL${__shunit_ansi_none} $*" >&2
exit ${SHUNIT_ERROR}
}
@@ -47,7 +47,7 @@
# shellcheck disable=SC2039
command [ "`echo -e test`" = '-e test' ] && __SHUNIT_CMD_ECHO_ESC='echo'
-__SHUNIT_UNAME_S=`uname -s`
+__SHUNIT_UNAME_S=`/nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/uname -s`
case "${__SHUNIT_UNAME_S}" in
BSD) __SHUNIT_CMD_EXPR='gexpr' ;;
*) __SHUNIT_CMD_EXPR='expr' ;;
@@ -56,14 +56,14 @@
# Commands a user can override if needed.
SHUNIT_CMD_EXPR=${SHUNIT_CMD_EXPR:-${__SHUNIT_CMD_EXPR}}
-SHUNIT_CMD_TPUT=${SHUNIT_CMD_TPUT:-${__SHUNIT_CMD_TPUT}}
+SHUNIT_CMD_TPUT=tput
# Enable color output. Options are 'never', 'always', or 'auto'.
SHUNIT_COLOR=${SHUNIT_COLOR:-auto}
# Specific shell checks.
if command [ -n "${ZSH_VERSION:-}" ]; then
- setopt |grep "^shwordsplit$" >/dev/null
+ setopt |/nix/store/pli7na7lnw1z73mdwi32jjgmxj08w4cb-gnugrep-3.7/bin/grep "^shwordsplit$" >/dev/null
if command [ $? -ne ${SHUNIT_TRUE} ]; then
_shunit_fatal 'zsh shwordsplit option is required for proper operation'
fi
@@ -93,9 +93,9 @@
__SHUNIT_ANSI_CYAN='\033[1;36m'
# Set the constants readonly.
-__shunit_constants=`set |grep '^__SHUNIT_' |cut -d= -f1`
-echo "${__shunit_constants}" |grep '^Binary file' >/dev/null && \
- __shunit_constants=`set |grep -a '^__SHUNIT_' |cut -d= -f1`
+__shunit_constants=`set |/nix/store/pli7na7lnw1z73mdwi32jjgmxj08w4cb-gnugrep-3.7/bin/grep '^__SHUNIT_' |/nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/cut -d= -f1`
+echo "${__shunit_constants}" |/nix/store/pli7na7lnw1z73mdwi32jjgmxj08w4cb-gnugrep-3.7/bin/grep '^Binary file' >/dev/null && \
+ __shunit_constants=`set |/nix/store/pli7na7lnw1z73mdwi32jjgmxj08w4cb-gnugrep-3.7/bin/grep -a '^__SHUNIT_' |/nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/cut -d= -f1`
for __shunit_const in ${__shunit_constants}; do
if command [ -z "${ZSH_VERSION:-}" ]; then
readonly "${__shunit_const}"
@@ -258,7 +258,7 @@
shunit_content_=$2
shunit_return=${SHUNIT_TRUE}
- if echo "$shunit_container_" | grep -F -- "$shunit_content_" > /dev/null; then
+ if echo "$shunit_container_" | /nix/store/pli7na7lnw1z73mdwi32jjgmxj08w4cb-gnugrep-3.7/bin/grep -F -- "$shunit_content_" > /dev/null; then
_shunit_assertPass
else
failNotFound "${shunit_message_}" "${shunit_content_}"
@@ -298,7 +298,7 @@
shunit_content_=$2
shunit_return=${SHUNIT_TRUE}
- if echo "$shunit_container_" | grep -F -- "$shunit_content_" > /dev/null; then
+ if echo "$shunit_container_" | /nix/store/pli7na7lnw1z73mdwi32jjgmxj08w4cb-gnugrep-3.7/bin/grep -F -- "$shunit_content_" > /dev/null; then
failFound "${shunit_message_}" "${shunit_content_}"
shunit_return=${SHUNIT_FALSE}
else
@@ -478,7 +478,7 @@
shunit_condition_=$1
# See if condition is an integer, i.e. a return value.
- shunit_match_=`expr "${shunit_condition_}" : '\([0-9]*\)'`
+ shunit_match_=`/nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/expr "${shunit_condition_}" : '\([0-9]*\)'`
shunit_return=${SHUNIT_TRUE}
if command [ -z "${shunit_condition_}" ]; then
# Null condition.
@@ -545,7 +545,7 @@
shunit_condition_=$1
# See if condition is an integer, i.e. a return value.
- shunit_match_=`expr "${shunit_condition_}" : '\([0-9]*\)'`
+ shunit_match_=`/nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/expr "${shunit_condition_}" : '\([0-9]*\)'`
shunit_return=${SHUNIT_TRUE}
if command [ -z "${shunit_condition_}" ]; then
# Null condition.
@@ -829,7 +829,7 @@
shunit_func_=${1:-}
__shunit_suite="${__shunit_suite:+${__shunit_suite} }${shunit_func_}"
- __shunit_testsTotal=`expr ${__shunit_testsTotal} + 1`
+ __shunit_testsTotal=`/nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/expr ${__shunit_testsTotal} + 1`
unset shunit_func_
}
@@ -896,24 +896,24 @@
# string: the temporary directory that was created
_shunit_mktempDir() {
# Try the standard `mktemp` function.
- ( exec mktemp -dqt shunit.XXXXXX 2>/dev/null ) && return
+ ( exec /nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/mktemp -dqt shunit.XXXXXX 2>/dev/null ) && return
# The standard `mktemp` didn't work. Use our own.
# shellcheck disable=SC2039
if command [ -r '/dev/urandom' -a -x '/usr/bin/od' ]; then
- _shunit_random_=`/usr/bin/od -vAn -N4 -tx4 </dev/urandom \
- |command sed 's/^[^0-9a-f]*//'`
+ _shunit_random_=`/nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/od -vAn -N4 -tx4 </dev/urandom \
+ |command /nix/store/cb596zcgx42b1gbw2cxngak2xwqsnpxb-gnused-4.8/bin/sed 's/^[^0-9a-f]*//'`
elif command [ -n "${RANDOM:-}" ]; then
# $RANDOM works
_shunit_random_=${RANDOM}${RANDOM}${RANDOM}$$
else
# `$RANDOM` doesn't work.
- _shunit_date_=`date '+%Y%m%d%H%M%S'`
- _shunit_random_=`expr "${_shunit_date_}" / $$`
+ _shunit_date_=`/nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/date '+%Y%m%d%H%M%S'`
+ _shunit_random_=`/nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/expr "${_shunit_date_}" / $$`
fi
_shunit_tmpDir_="${TMPDIR:-/tmp}/shunit.${_shunit_random_}"
- ( umask 077 && command mkdir "${_shunit_tmpDir_}" ) || \
+ ( umask 077 && command /nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/mkdir "${_shunit_tmpDir_}" ) || \
_shunit_fatal 'could not create temporary directory! exiting'
echo "${_shunit_tmpDir_}"
@@ -928,11 +928,11 @@
for _shunit_func_ in oneTimeSetUp oneTimeTearDown setUp tearDown suite noexec
do
_shunit_file_="${__shunit_tmpDir}/${_shunit_func_}"
- command cat <<EOF >"${_shunit_file_}"
+ command /nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/cat <<EOF >"${_shunit_file_}"
#! /bin/sh
exit ${SHUNIT_TRUE}
EOF
- command chmod +x "${_shunit_file_}"
+ command /nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/chmod +x "${_shunit_file_}"
done
unset _shunit_file_
@@ -974,7 +974,7 @@
command [ $? -eq ${SHUNIT_TRUE} ] \
|| _shunit_warn "oneTimeTearDown() returned non-zero return code."
- command rm -fr "${__shunit_tmpDir}"
+ command /nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/rm -fr "${__shunit_tmpDir}"
fi
if command [ "${_shunit_name_}" != 'EXIT' ]; then
@@ -1027,7 +1027,7 @@
# colors returns the number of supported colors for the TERM.
_shunit_colors() {
- _shunit_tput_=`${SHUNIT_CMD_TPUT} colors 2>/dev/null`
+ _shunit_tput_=`/nix/store/q5r6k6n9yhk906qmd3rhli5ljrcnxmwh-ncurses-6.3/bin/tput colors 2>/dev/null`
if command [ $? -eq 0 ]; then
echo "${_shunit_tput_}"
else
@@ -1068,9 +1068,9 @@
# Update stats.
if command [ ${__shunit_testSuccess} -eq ${SHUNIT_TRUE} ]; then
- __shunit_testsPassed=`expr ${__shunit_testsPassed} + 1`
+ __shunit_testsPassed=`/nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/expr ${__shunit_testsPassed} + 1`
else
- __shunit_testsFailed=`expr ${__shunit_testsFailed} + 1`
+ __shunit_testsFailed=`/nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/expr ${__shunit_testsFailed} + 1`
fi
done
@@ -1096,9 +1096,9 @@
echo
_shunit_msg_="Ran ${__shunit_ansi_cyan}${__shunit_testsTotal}${__shunit_ansi_none}"
if command [ "${__shunit_testsTotal}" -eq 1 ]; then
- ${__SHUNIT_CMD_ECHO_ESC} "${_shunit_msg_} test."
+ echo -e "${_shunit_msg_} test."
else
- ${__SHUNIT_CMD_ECHO_ESC} "${_shunit_msg_} tests."
+ echo -e "${_shunit_msg_} tests."
fi
if command [ ${_shunit_ok_} -eq ${SHUNIT_TRUE} ]; then
@@ -1114,7 +1114,7 @@
fi
echo
- ${__SHUNIT_CMD_ECHO_ESC} "${_shunit_msg_}"
+ echo -e "${_shunit_msg_}"
__shunit_reportGenerated=${SHUNIT_TRUE}
unset _shunit_msg_ _shunit_ok_
@@ -1136,8 +1136,8 @@
# Args:
# None
_shunit_assertPass() {
- __shunit_assertsPassed=`expr ${__shunit_assertsPassed} + 1`
- __shunit_assertsTotal=`expr ${__shunit_assertsTotal} + 1`
+ __shunit_assertsPassed=`/nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/expr ${__shunit_assertsPassed} + 1`
+ __shunit_assertsTotal=`/nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/expr ${__shunit_assertsTotal} + 1`
}
# Records a test failure.
@@ -1148,7 +1148,7 @@
__shunit_testSuccess=${SHUNIT_FALSE}
_shunit_incFailedCount
- \[ $# -gt 0 ] && ${__SHUNIT_CMD_ECHO_ESC} \
+ \[ $# -gt 0 ] && echo -e \
"${__shunit_ansi_red}ASSERT:${__shunit_ansi_none}$*"
}
@@ -1157,8 +1157,8 @@
# Args:
# none
_shunit_incFailedCount() {
- __shunit_assertsFailed=`expr "${__shunit_assertsFailed}" + 1`
- __shunit_assertsTotal=`expr "${__shunit_assertsTotal}" + 1`
+ __shunit_assertsFailed=`/nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/expr "${__shunit_assertsFailed}" + 1`
+ __shunit_assertsTotal=`/nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/expr "${__shunit_assertsTotal}" + 1`
}
@@ -1167,8 +1167,8 @@
# Args:
# None
_shunit_assertSkip() {
- __shunit_assertsSkipped=`expr "${__shunit_assertsSkipped}" + 1`
- __shunit_assertsTotal=`expr "${__shunit_assertsTotal}" + 1`
+ __shunit_assertsSkipped=`/nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/expr "${__shunit_assertsSkipped}" + 1`
+ __shunit_assertsTotal=`/nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/expr "${__shunit_assertsTotal}" + 1`
}
# Prepare a script filename for sourcing.
@@ -1203,7 +1203,7 @@
# Escape the character.
# shellcheck disable=SC1003,SC2086
- echo ''${_shunit_s_}'' |command sed 's/\'${_shunit_c_}'/\\\'${_shunit_c_}'/g'
+ echo ''${_shunit_s_}'' |command /nix/store/cb596zcgx42b1gbw2cxngak2xwqsnpxb-gnused-4.8/bin/sed 's/\'${_shunit_c_}'/\\\'${_shunit_c_}'/g'
unset _shunit_c_ _shunit_s_
}
@@ -1242,9 +1242,9 @@
# function name, and output everything on a single line.
_shunit_regex_='^\s*((function test[A-Za-z0-9_-]*)|(test[A-Za-z0-9_-]* *\(\)))'
# shellcheck disable=SC2196
- egrep "${_shunit_regex_}" "${_shunit_script_}" \
- |command sed 's/^[^A-Za-z0-9_-]*//;s/^function //;s/\([A-Za-z0-9_-]*\).*/\1/g' \
- |xargs
+ /nix/store/pli7na7lnw1z73mdwi32jjgmxj08w4cb-gnugrep-3.7/bin/egrep "${_shunit_regex_}" "${_shunit_script_}" \
+ |command /nix/store/cb596zcgx42b1gbw2cxngak2xwqsnpxb-gnused-4.8/bin/sed 's/^[^A-Za-z0-9_-]*//;s/^function //;s/\([A-Za-z0-9_-]*\).*/\1/g' \
+ |/nix/store/04b3mkrsngmhc9r38azaq4fxjh1g9b6p-findutils-4.9.0/bin/xargs
unset _shunit_regex_ _shunit_script_
}
@@ -1270,7 +1270,7 @@
# Provide a public temporary directory for unit test scripts.
# TODO(kward): document this.
SHUNIT_TMPDIR="${__shunit_tmpDir}/tmp"
-command mkdir "${SHUNIT_TMPDIR}"
+command /nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/mkdir "${SHUNIT_TMPDIR}"
# Setup traps to clean up after ourselves.
trap '_shunit_cleanup EXIT' 0
@@ -1341,3 +1341,35 @@
# That's it folks.
command [ "${__shunit_testsFailed}" -eq 0 ]
exit $?
+
+### resholve directives (auto-generated) ## format_version: 3
+# resholve: fake builtin:setopt
+# resholve: fake function:noexec
+# resholve: fake function:oneTimeSetUp
+# resholve: fake function:oneTimeTearDown
+# resholve: fake function:setUp
+# resholve: fake function:suite
+# resholve: fake function:tearDown
+# resholve: fix $SHUNIT_CMD_TPUT:tput
+# resholve: fix $__SHUNIT_CMD_ECHO_ESC:'echo -e'
+# resholve: fix /usr/bin/od
+# resholve: keep $_SHUNIT_LINENO_
+# resholve: keep /nix/store/04b3mkrsngmhc9r38azaq4fxjh1g9b6p-findutils-4.9.0/bin/xargs
+# resholve: keep /nix/store/cb596zcgx42b1gbw2cxngak2xwqsnpxb-gnused-4.8/bin/sed
+# resholve: keep /nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/cat
+# resholve: keep /nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/chmod
+# resholve: keep /nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/cut
+# resholve: keep /nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/date
+# resholve: keep /nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/expr
+# resholve: keep /nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/mkdir
+# resholve: keep /nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/mktemp
+# resholve: keep /nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/od
+# resholve: keep /nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/rm
+# resholve: keep /nix/store/fbj5c9ngafgr5nbqj528984yp75jghqw-coreutils-9.0/bin/uname
+# resholve: keep /nix/store/pli7na7lnw1z73mdwi32jjgmxj08w4cb-gnugrep-3.7/bin/egrep
+# resholve: keep /nix/store/pli7na7lnw1z73mdwi32jjgmxj08w4cb-gnugrep-3.7/bin/grep
+# resholve: keep /nix/store/q5r6k6n9yhk906qmd3rhli5ljrcnxmwh-ncurses-6.3/bin/tput
+# resholve: keep eval:_shunit_prepForSourcing
+# resholve: keep eval:_shunit_test_
+# resholve: keep eval:shunit_condition_
+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment