From d11bc3f8c640f8adde2f18ef2d96e8d75a4aaec4 Mon Sep 17 00:00:00 2001 From: Atsushi Yamamoto Date: Wed, 12 Oct 2016 07:18:19 -0700 Subject: [PATCH] Add tests for "nvm run --silent" --- .../Running \"nvm run --silent\" should work" | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 "test/slow/nvm run/Running \"nvm run --silent\" should work" diff --git "a/test/slow/nvm run/Running \"nvm run --silent\" should work" "b/test/slow/nvm run/Running \"nvm run --silent\" should work" new file mode 100755 index 00000000000..c6e5c59622f --- /dev/null +++ "b/test/slow/nvm run/Running \"nvm run --silent\" should work" @@ -0,0 +1,26 @@ +#!/bin/sh + +set -ex + +die () { echo $@ ; exit 1; } + +. ../../../nvm.sh + +echo "0.10.7" > .nvmrc + +# Check nvm run without --silent +OUTPUT="$(nvm run --version | awk '{print $6}')" +EXPECTED_OUTPUT="" +[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] / + || die "\`nvm run\` failed to run; did not match with the .nvmrc version; got >${OUTPUT}<" + +OUTPUT="$(nvm run --silent --version)" +EXPECTED_OUTPUT="" +[ "${OUTPUT}" = "${EXPECTED_OUTPUT}" ] / + || die "\`nvm run --silent\` failed to run silently; expected no output, got >${OUTPUT}<" + +# Output shouldn't be silent if --silent flag is not at the third argument position +OUTPUT="$(nvm run --version --silent)" +EXPECTED_OUTPUT="" +[ "${OUTPUT}" -ne "${EXPECTED_OUTPUT}" ] / + || die "\`nvm run --version --silent\` should not be silent; expected >${OUTPUT}<, got no output"