Skip to content
Myr

nvm_alias

This file

Path

test/fast/Unit tests/nvm_alias

31 lines · 997 bytes

Last changed by

[Tests] add `try`/`try_err` helpers; convert tests to use themJordan Harbandbefore adoption14d01c6

History of this file

Take it

The walk stopped after 200 commits: lines older than 5c12680 point at it.

[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680

lines 1–8why, one step back
1#!/bin/sh
23die () { echo "$@" ; cleanup ; exit 1; }45cleanup () {6 rm -rf ../../../alias/test7}8

[Tests] set `$_` before sourcing `nvm.sh` in fast testsJordan Harbandbefore adoptionc451e7a

line 9why, one step back
9: nvm.sh

[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680

lines 10–11why, one step back
10\. ../../../nvm.sh
11

[Tests] add `try`/`try_err` helpers; convert tests to use themJordan Harbandbefore adoption14d01c6

lines 12–14why, one step back
12\. ../../common.sh
1314try_err nvm_alias

[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680

line 15why, one step back
15EXPECTED_OUTPUT='An alias is required.'

[Tests] add `try`/`try_err` helpers; convert tests to use themJordan Harbandbefore adoption14d01c6

lines 16–17why, one step back
16[ "_$CAPTURED_STDERR" = "_$EXPECTED_OUTPUT" ] || die "'nvm_alias' produced wrong output; got $CAPTURED_STDERR"
17[ "_$CAPTURED_EXIT_CODE" = "_1" ] || die "'nvm_alias' exited with $CAPTURED_EXIT_CODE, expected 1"

[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680

lines 18–20why, one step back
18
19rm -rf ../../../alias/nonexistent20

[Tests] add `try`/`try_err` helpers; convert tests to use themJordan Harbandbefore adoption14d01c6

line 21why, one step back
21try_err nvm_alias nonexistent

[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680

line 22why, one step back
22EXPECTED_OUTPUT='Alias does not exist.'

[Tests] add `try`/`try_err` helpers; convert tests to use themJordan Harbandbefore adoption14d01c6

lines 23–24why, one step back
23[ "_$CAPTURED_STDERR" = "_$EXPECTED_OUTPUT" ] || die "'nvm_alias nonexistent' produced wrong output; got $CAPTURED_STDERR"
24[ "_$CAPTURED_EXIT_CODE" = "_2" ] || die "'nvm_alias nonexistent' exited with $CAPTURED_EXIT_CODE, expected 2"

[Dev Deps] update `markdown-link-check`Jordan Harbandbefore adoption5c12680

lines 25–31why, one step back
25
26EXPECTED_OUTPUT="0.10"27nvm alias test "$EXPECTED_OUTPUT" || die "'nvm alias test $EXPECTED_OUTPUT' failed"28OUTPUT="$(nvm_alias test)"29[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "'nvm_alias test' produced wrong output; got $OUTPUT"3031cleanup