2014-09-29 16:34:50 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
die () { echo $@ ; exit 1; }
|
|
|
|
|
|
|
|
. ../../../nvm.sh
|
|
|
|
|
2016-02-07 14:34:49 +08:00
|
|
|
INPUT="0.1.2"
|
|
|
|
OUTPUT="$(nvm_format_version "$INPUT")"
|
2014-09-29 16:34:50 +08:00
|
|
|
EXPECTED_OUTPUT="v0.1.2"
|
2016-02-07 14:34:49 +08:00
|
|
|
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "nvm_format_version $INPUT did not return $EXPECTED_OUTPUT; got $OUTPUT"
|
2014-09-29 16:34:50 +08:00
|
|
|
|
2016-02-07 14:34:49 +08:00
|
|
|
INPUT="0.1"
|
|
|
|
OUTPUT="$(nvm_format_version "$INPUT")"
|
2014-09-29 16:34:50 +08:00
|
|
|
EXPECTED_OUTPUT="v0.1.0"
|
2016-02-07 14:34:49 +08:00
|
|
|
[ "_$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
|
|
|
|