Files
nvm/test/fast/Unit tests/make_echo
T
2026-04-23 17:16:32 +03:00

23 lines
521 B
Bash
Executable File

#!/bin/sh
die () { echo "$@" ; exit 1; }
\. ../../common.sh
TMPFILE="$(mktemp)"
trap 'rm -f "${TMPFILE}"' EXIT
make_echo "${TMPFILE}" "hello_nvm" || die 'make_echo returned non-zero'
# shebang must still be on line 1
[ "$(head -n 1 "${TMPFILE}")" = '#!/bin/sh' ] \
|| die 'make_echo overwrote the shebang'
# script body must be present
grep -q 'hello_nvm' "${TMPFILE}" \
|| die 'make_echo did not write the echo body'
# file must be executable
[ -x "${TMPFILE}" ] \
|| die 'make_echo did not chmod the file'