diff --git a/nvm.sh b/nvm.sh index 1fbefb5..aa5bae8 100755 --- a/nvm.sh +++ b/nvm.sh @@ -3439,7 +3439,7 @@ nvm() { shift # consume "-s" nobinary=1 if [ $nosource -eq 1 ]; then - nvm err '-s and -b cannot be set together since they would skip install from both binary and source' + nvm_err '-s and -b cannot be set together since they would skip install from both binary and source' return 6 fi ;; @@ -3447,7 +3447,7 @@ nvm() { shift # consume "-b" nosource=1 if [ $nobinary -eq 1 ]; then - nvm err '-s and -b cannot be set together since they would skip install from both binary and source' + nvm_err '-s and -b cannot be set together since they would skip install from both binary and source' return 6 fi ;; diff --git a/test/fast/Unit tests/nvm install -s and -b conflict b/test/fast/Unit tests/nvm install -s and -b conflict new file mode 100755 index 0000000..787bbca --- /dev/null +++ b/test/fast/Unit tests/nvm install -s and -b conflict @@ -0,0 +1,18 @@ +#!/bin/sh + +die () { echo "$@" ; exit 1; } + +: nvm.sh +\. ../../../nvm.sh + +\. ../../common.sh + +EXPECTED_ERR='-s and -b cannot be set together since they would skip install from both binary and source' + +try_err nvm install -s -b 0.10.0 +[ "${CAPTURED_EXIT_CODE}" = "6" ] || die "Expected exit code 6 for -s -b, got ${CAPTURED_EXIT_CODE}" +[ "${CAPTURED_STDERR}" = "${EXPECTED_ERR}" ] || die "Expected >${EXPECTED_ERR}<, got >${CAPTURED_STDERR}<" + +try_err nvm install -b -s 0.10.0 +[ "${CAPTURED_EXIT_CODE}" = "6" ] || die "Expected exit code 6 for -b -s, got ${CAPTURED_EXIT_CODE}" +[ "${CAPTURED_STDERR}" = "${EXPECTED_ERR}" ] || die "Expected >${EXPECTED_ERR}<, got >${CAPTURED_STDERR}<"