[Tests] add unit tests for nvm_version_greater_than_or_equal_to

This commit is contained in:
Hridhin Varkey Joseph
2026-10-03 11:51:31 +05:30
committed by Jordan Harband
parent cb96d2a56a
commit a27fb0bd78
+20
View File
@@ -0,0 +1,20 @@
#!/bin/sh
die () { echo "$@" ; exit 1; }
: nvm.sh
\. ../../../nvm.sh
nvm_version_greater_than_or_equal_to 0.10.0 0.2.12 || die '"nvm_version_greater_than_or_equal_to 0.10.0 0.2.12" did not return true'
nvm_version_greater_than_or_equal_to 0.10.0 0.10.0 || die '"nvm_version_greater_than_or_equal_to" did not return true for the same two versions'
nvm_version_greater_than_or_equal_to v0.10.0 0.10.0 || die '"nvm_version_greater_than_or_equal_to v0.10.0 0.10.0" did not return true'
if nvm_version_greater_than_or_equal_to 0.10.0 0.20.12; then
die '"nvm_version_greater_than_or_equal_to 0.10.0 0.20.12" returned true'
fi
if nvm_version_greater_than_or_equal_to 0.10.0 ''; then
die '"nvm_version_greater_than_or_equal_to" returned true with an empty argument'
fi