mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-05-10 14:21:50 +00:00
Unit tests: add nvm_has
This commit is contained in:
parent
d5d66c34d9
commit
e0a22ccf4a
12
test/fast/Unit tests/nvm_has
Executable file
12
test/fast/Unit tests/nvm_has
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
nvm_has cat && type cat > /dev/null || die 'nvm_has locates "cat" properly'
|
||||
|
||||
[ "~$(nvm_has foobarbaz 2>&1)" = "~" ] || die "nvm_has does not suppress error output"
|
||||
|
||||
! nvm_has foobarbaz && ! type foobarbaz >/dev/null 2>&1 || die "nvm_has does not return a nonzero exit code when not found"
|
||||
|
Loading…
Reference in New Issue
Block a user