-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Docs]
unalias
: add more specific error message for builtin aliases
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
test/fast/Aliases/"nvm unalias" should not accept aliases with names equal to built-in alias
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'" |