mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-10-30 09:18:59 +08:00
[Docs] unalias: add more specific error message for builtin aliases
This commit is contained in:
committed by
Jordan Harband
parent
cc0750eb5d
commit
02997b0753
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
\. ../../../nvm.sh
|
||||
|
||||
die () { echo "$@" ; exit 1; }
|
||||
|
||||
OUTPUT="$(nvm unalias node 2>&1)"
|
||||
EXPECTED_OUTPUT="node is a default (built-in) alias and cannot be deleted."
|
||||
[ "$OUTPUT" = "$EXPECTED_OUTPUT" ] || die "trying to remove a built-in alias should fail with '$EXPECTED_OUTPUT', got '$OUTPUT'"
|
||||
|
||||
OUTPUT="$(nvm unalias stable 2>&1)"
|
||||
EXPECTED_OUTPUT="stable is a default (built-in) alias and cannot be deleted."
|
||||
[ "$OUTPUT" = "$EXPECTED_OUTPUT" ] || die "trying to remove a built-in alias should fail with '$EXPECTED_OUTPUT', got '$OUTPUT'"
|
||||
|
||||
OUTPUT="$(nvm unalias unstable 2>&1)"
|
||||
EXPECTED_OUTPUT="unstable is a default (built-in) alias and cannot be deleted."
|
||||
[ "$OUTPUT" = "$EXPECTED_OUTPUT" ] || die "trying to remove a built-in alias should fail with '$EXPECTED_OUTPUT', got '$OUTPUT'"
|
||||
|
||||
OUTPUT="$(nvm unalias iojs 2>&1)"
|
||||
EXPECTED_OUTPUT="iojs is a default (built-in) alias and cannot be deleted."
|
||||
[ "$OUTPUT" = "$EXPECTED_OUTPUT" ] || die "trying to remove a built-in alias should fail with '$EXPECTED_OUTPUT', got '$OUTPUT'"
|
||||
|
||||
OUTPUT="$(nvm unalias system 2>&1)"
|
||||
EXPECTED_OUTPUT="system is a default (built-in) alias and cannot be deleted."
|
||||
[ "$OUTPUT" = "$EXPECTED_OUTPUT" ] || die "trying to remove a built-in alias should fail with '$EXPECTED_OUTPUT', got '$OUTPUT'"
|
||||
Reference in New Issue
Block a user