OUTPUT="$(nvm_ensure_version_installed system 2>&1)"
EXIT_CODE=$?
EXPECTED_OUTPUT='N/A: no system version of node/io.js is installed.'
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "expected 'nvm_ensure_version_installed system' with neither installed to give $EXPECTED_OUTPUT, got $OUTPUT"
[ "_$EXIT_CODE" = "_1" ] || die "expected 'nvm_ensure_version_installed system' with neither installed to exit with 1, got $EXIT_CODE"
nvm_has_system_node() { return 0; }
nvm_has_system_iojs() { return 1; }
OUTPUT="$(nvm_ensure_version_installed system 2>&1)"
EXIT_CODE=$?
EXPECTED_OUTPUT=''
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "expected 'nvm_ensure_version_installed system' with node installed to give $EXPECTED_OUTPUT, got $OUTPUT"
[ "_$EXIT_CODE" = "_0" ] || die "expected 'nvm_ensure_version_installed system' with node installed to exit with 0, got $EXIT_CODE"
nvm_has_system_node() { return 1; }
nvm_has_system_iojs() { return 0; }
OUTPUT="$(nvm_ensure_version_installed system 2>&1)"
EXIT_CODE=$?
EXPECTED_OUTPUT=''
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "expected 'nvm_ensure_version_installed system' with iojs installed to give $EXPECTED_OUTPUT, got $OUTPUT"
[ "_$EXIT_CODE" = "_0" ] || die "expected 'nvm_ensure_version_installed system' with iojs installed to exit with 0, got $EXIT_CODE"