2014-09-29 13:43:46 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
die () { echo $@ ; exit 1; }
|
|
|
|
|
2016-11-04 13:15:18 +08:00
|
|
|
\. ../../../nvm.sh
|
2014-09-29 13:43:46 +08:00
|
|
|
|
|
|
|
EXPECTED_FIRST_MSG="nvm_print_implicit_alias must be specified with local or remote as the first argument."
|
|
|
|
[ "_$(nvm_print_implicit_alias 2>&1)" = "_$EXPECTED_FIRST_MSG" ] \
|
|
|
|
|| die "nvm_print_implicit_alias did not require local|remote as first argument"
|
|
|
|
[ "_$(nvm_print_implicit_alias foo 2>&1)" = "_$EXPECTED_FIRST_MSG" ] \
|
|
|
|
|| die "nvm_print_implicit_alias did not require local|remote as first argument"
|
|
|
|
|
|
|
|
FIRST_EXIT_CODE="$(nvm_print_implicit_alias > /dev/null 2>&1 ; echo $?)"
|
|
|
|
[ "_$FIRST_EXIT_CODE" = "_1" ] \
|
|
|
|
|| die "nvm_print_implicit_alias without local|remote had wrong exit code: expected 1, got $FIRST_EXIT_CODE"
|
|
|
|
|
2015-02-11 06:41:45 +08:00
|
|
|
EXPECTED_SECOND_MSG="Only implicit aliases 'stable', 'unstable', 'iojs', and 'node' are supported."
|
2014-09-29 13:43:46 +08:00
|
|
|
[ "_$(nvm_print_implicit_alias local 2>&1)" = "_$EXPECTED_SECOND_MSG" ] \
|
2015-02-11 06:41:45 +08:00
|
|
|
|| die "nvm_print_implicit_alias did not require stable|unstable|iojs|node as second argument"
|
2014-09-29 13:43:46 +08:00
|
|
|
[ "_$(nvm_print_implicit_alias local foo 2>&1)" = "_$EXPECTED_SECOND_MSG" ] \
|
2015-02-11 06:41:45 +08:00
|
|
|
|| die "nvm_print_implicit_alias did not require stable|unstable|iojs|node as second argument"
|
2014-09-29 13:43:46 +08:00
|
|
|
|
|
|
|
SECOND_EXIT_CODE="$(nvm_print_implicit_alias local > /dev/null 2>&1 ; echo $?)"
|
|
|
|
[ "_$SECOND_EXIT_CODE" = "_2" ] \
|
2015-02-11 06:41:45 +08:00
|
|
|
|| die "nvm_print_implicit_alias without stable|unstable|iojs|node had wrong exit code: expected 2, got $SECOND_EXIT_CODE"
|
2014-09-29 13:43:46 +08:00
|
|
|
|