Files
nvm/test/fast/Unit tests/make_echo
Андрій Шовкошитний 20d52b6419 [tests] remove double-substitution in assert_ok and assert_not_ok
Co-authored-by: Андрій Шовкошитний <198119344+enlightened88@users.noreply.github.com>
Co-authored-by: Jordan Harband <ljharb@gmail.com>
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'