-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show "∞" when there's a circular alias reference.
- Loading branch information
Showing
6 changed files
with
85 additions
and
2 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
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,36 @@ | ||
#!/bin/sh | ||
|
||
die () { echo $@ ; exit 1; } | ||
|
||
. ../../../../nvm.sh | ||
|
||
ALIAS="$(nvm_resolve_alias loopback)" | ||
[ "_$ALIAS" = "_∞" ] || die "nvm_resolve_alias loopback was not ∞; got $ALIAS" | ||
OUTPUT="$(nvm alias loopback)" | ||
EXPECTED_OUTPUT="loopback -> loopback (-> ∞)" | ||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm alias loopback was not $EXPECTED_OUTPUT; got $OUTPUT" | ||
|
||
ALIAS="$(nvm_resolve_alias one)" | ||
[ "_$ALIAS" = "_∞" ] || die "nvm_resolve_alias one was not ∞; got $ALIAS" | ||
OUTPUT="$(nvm alias one)" | ||
EXPECTED_OUTPUT="one -> two (-> ∞)" | ||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm alias one was not $EXPECTED_OUTPUT; got $OUTPUT" | ||
|
||
ALIAS="$(nvm_resolve_alias two)" | ||
[ "_$ALIAS" = "_∞" ] || die "nvm_resolve_alias two was not ∞; got $ALIAS" | ||
OUTPUT="$(nvm alias two)" | ||
EXPECTED_OUTPUT="two -> three (-> ∞)" | ||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm alias two was not $EXPECTED_OUTPUT; got $OUTPUT" | ||
|
||
ALIAS="$(nvm_resolve_alias three)" | ||
[ "_$ALIAS" = "_∞" ] || die "nvm_resolve_alias three was not ∞; got $ALIAS" | ||
OUTPUT="$(nvm alias three)" | ||
EXPECTED_OUTPUT="three -> one (-> ∞)" | ||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm alias three was not $EXPECTED_OUTPUT; got $OUTPUT" | ||
|
||
ALIAS="$(nvm_resolve_alias four)" | ||
[ "_$ALIAS" = "_∞" ] || die "nvm_resolve_alias four was not ∞; got $ALIAS" | ||
OUTPUT="$(nvm alias four)" | ||
EXPECTED_OUTPUT="four -> two (-> ∞)" | ||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm alias four was not $EXPECTED_OUTPUT; got $OUTPUT" | ||
|
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,10 @@ | ||
#!/bin/sh | ||
|
||
echo loopback > ../../../../alias/loopback | ||
|
||
echo two > ../../../../alias/one | ||
echo three > ../../../../alias/two | ||
echo one > ../../../../alias/three | ||
|
||
echo two > ../../../../alias/four | ||
|
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,10 @@ | ||
#!/bin/sh | ||
|
||
rm -f ../../../../alias/loopback | ||
|
||
rm -f ../../../../alias/one | ||
rm -f ../../../../alias/two | ||
rm -f ../../../../alias/three | ||
|
||
rm -f ../../../../alias/four | ||
|
File renamed without changes.
File renamed without changes.
9b91734
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not to rant or anything, but this much code for only displaying a infinity symbol seems excessive..
9b91734
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not about the infinity symbol, it's about preventing a circular loop. In order to do it, I needed a semaphore/signal value, and
∞
seemed logical enough.