mirror of
https://github.com/nvm-sh/nvm.git
synced 2026-05-18 21:31:29 +08:00
[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>
This commit is contained in:
committed by
Jordan Harband
parent
d200a21559
commit
20d52b6419
22
test/fast/Unit tests/make_echo
Executable file
22
test/fast/Unit tests/make_echo
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/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'
|
||||
Reference in New Issue
Block a user