nvm/test/fast/Unit tests/nvm_format_version

22 lines
654 B
Plaintext
Raw Normal View History

2014-09-29 16:34:50 +08:00
#!/bin/sh
die () { echo $@ ; exit 1; }
\. ../../../nvm.sh
2014-09-29 16:34:50 +08:00
INPUT="0.1.2"
OUTPUT="$(nvm_format_version "$INPUT")"
2014-09-29 16:34:50 +08:00
EXPECTED_OUTPUT="v0.1.2"
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_format_version $INPUT did not return $EXPECTED_OUTPUT; got $OUTPUT"
2014-09-29 16:34:50 +08:00
INPUT="0.1"
OUTPUT="$(nvm_format_version "$INPUT")"
2014-09-29 16:34:50 +08:00
EXPECTED_OUTPUT="v0.1.0"
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_format_version $INPUT did not return $EXPECTED_OUTPUT; got $OUTPUT"
INPUT="1.2.3.4.5"
OUTPUT="$(nvm_format_version "$INPUT")"
EXPECTED_OUTPUT="v1.2.3"
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_format_version $INPUT did not return $EXPECTED_OUTPUT; got $OUTPUT"
2014-09-29 16:34:50 +08:00