Skip to content
Myr

nvm_cd

This file

Path

test/fast/Unit tests/nvm_cd

23 lines · 579 bytes

Last changed by

landed by oscabrielb1b3a00

History of this file

Take it

1#!/bin/sh23die () { echo "$@" ; exit 1; }45: nvm.sh6\. ../../../nvm.sh78EXPECTED="$(\cd .. && pwd)"910# a user-defined `cd` function that rejects nvm's arguments, like cdhist's (#3835)11cd() {12  echo 'user-defined cd function was called' >&213  return 114}1516OUTPUT="$(nvm_cd .. 2>&1 && pwd)"17[ "${OUTPUT}" = "${EXPECTED}" ] || die "expected '${EXPECTED}', got '${OUTPUT}'"1819# shellcheck disable=SC208620OUTPUT="$(nvm_cd ${NVM_CD_FLAGS} .. 2>&1 && pwd)"21[ "${OUTPUT}" = "${EXPECTED}" ] || die "with NVM_CD_FLAGS '${NVM_CD_FLAGS}', expected '${EXPECTED}', got '${OUTPUT}'"2223unset -f cd