Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try to get shell version, OS and its version, curl/wget/git version.
- Loading branch information
1 parent
f344d06
commit c7e6b22
Showing
2 changed files
with
81 additions
and
1 deletion.
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,40 @@ | ||
#!/bin/sh | ||
|
||
cleanup() { | ||
unalias wget > /dev/null 2>&1 | ||
unset -f wget > /dev/null 2>&1 | ||
unset WGET_EXPECTED_INFO WGET_COMMAND_INFO | ||
} | ||
|
||
die() { echo "$@" ; cleanup ; exit 1; } | ||
|
||
\. ../../../nvm.sh | ||
|
||
|
||
# 1. test wget command | ||
WGET_COMMAND_INFO="$(nvm_command_info wget)" | ||
WGET_EXPECTED_INFO="$(which wget)" | ||
[ "${WGET_COMMAND_INFO}" = "${WGET_EXPECTED_INFO}" ] || die "wget command info wrong(stage 1), expected: '${WGET_EXPECTED_INFO}', got '${WGET_COMMAND_INFO}'" | ||
|
||
cleanup | ||
|
||
# 2. test aliased wget | ||
shopt -s expand_aliases | ||
# enable expand_aliases to make alias working in interactive shell | ||
alias wget="wget -V" | ||
WGET_COMMAND_INFO="$(nvm_command_info wget)" | ||
WGET_EXPECTED_INFO="$(which wget) (wget -V)" | ||
[ "${WGET_COMMAND_INFO}" = "${WGET_EXPECTED_INFO}" ] || die "wget command info wrong(stage 2), expected: '${WGET_EXPECTED_INFO}', got '${WGET_COMMAND_INFO}'" | ||
|
||
cleanup | ||
|
||
# 3. test wget function | ||
wget() { | ||
echo "wget function" | ||
} | ||
|
||
WGET_COMMAND_INFO="$(nvm_command_info wget)" | ||
WGET_EXPECTED_INFO="$(type wget)" | ||
[ "${WGET_COMMAND_INFO}" = "${WGET_EXPECTED_INFO}" ] || die "wget command info wrong(stage 3), expected: '${WGET_EXPECTED_INFO}', got '${WGET_COMMAND_INFO}'" | ||
|
||
cleanup |