nvm_err
This file
Path
test/fast/Unit tests/nvm_err
21 lines · 818 bytes
Last changed by
[Fix] `nvm_err`, `nvm_err_with_colors`: do not fail when stderr is closedLazizbek Ergashevbefore adoptionccb49e5
History of this fileTake it
1#!/bin/sh23die () { echo "$@" ; exit 1; }45: nvm.sh6\. ../../../nvm.sh78\. ../../common.sh910try_err nvm_err 'an error'11EXPECTED_OUTPUT='an error'12[ "${CAPTURED_STDERR}" = "${EXPECTED_OUTPUT}" ] || die "expected >${EXPECTED_OUTPUT}<, got >${CAPTURED_STDERR}<"13[ "${CAPTURED_EXIT_CODE}" = 0 ] || die "expected to exit with code 0, got ${CAPTURED_EXIT_CODE}"1415try_err nvm_err_with_colors 'an error'16EXPECTED_OUTPUT='an error'17[ "${CAPTURED_STDERR}" = "${EXPECTED_OUTPUT}" ] || die "expected >${EXPECTED_OUTPUT}<, got >${CAPTURED_STDERR}<"18[ "${CAPTURED_EXIT_CODE}" = 0 ] || die "expected to exit with code 0, got ${CAPTURED_EXIT_CODE}"1920nvm_err 'an error' 2>&- || die "nvm_err with stderr closed exited with code $?"21nvm_err_with_colors 'an error' 2>&- || die "nvm_err_with_colors with stderr closed exited with code $?"