Skip to content
Myr

Add nvm_ls_current test for #605 and `zsh`.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Jordan Harband · committed by Jordan Harband · parent 67e8939 · Browse files · 1 file+8 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−4 removed

  • tests:+8 added−4 removed

1 file+8 added−4 removed

modified:test/fast/Unit tests/nvm_ls_current+8 added-4 removed
1#!/bin/sh23die () { echo $@ ; exit 1; }3TEST_PWD=$(pwd)4TEST_DIR="$TEST_PWD/nvm_ls_current_tmp"56cleanup() { rm -rf "$TEST_DIR"; unset -f return_zero; unalias node; }7die () { echo $@ ; cleanup ; exit 1; }89. ../../../nvm.sh1011return_zero () { return 0; }1213[ "$(nvm deactivate > /dev/null 2>&1 ; nvm_ls_current)" = "system" ] || die 'when deactivated, did not return "system"'1411TEST_PWD=$(pwd)12TEST_DIR="$TEST_PWD/nvm_ls_current_tmp"15rm -rf "$TEST_DIR"16mkdir "$TEST_DIR"17ln -s "$(command which which)" "$TEST_DIR/which"18ln -s "$(command which dirname)" "$TEST_DIR/dirname"
6 unmodified lines
25chmod a+x "$TEST_DIR/node"2627[ "$(alias nvm_tree_contains_path='return_zero' && PATH="$TEST_DIR" nvm_ls_current)" = "VERSION FOO!" ] || die 'when activated, did not return nvm node version'2827rm -rf "$TEST_DIR"29alias node='node --harmony'30[ "$(alias nvm_tree_contains_path='return_zero' && PATH="$TEST_DIR" nvm_ls_current)" = "VERSION FOO!" ] || die 'when activated and node aliased, did not return nvm node version'3132cleanup