Fix #3: ensure gitversion produces reliable versioning info across all branches

This commit is contained in:
2015-01-10 18:05:39 -08:00
parent 98740ba3aa
commit 7ce5fabce7
10 changed files with 462 additions and 366 deletions

39
tests/test_taggit.sh Normal file
View File

@@ -0,0 +1,39 @@
#!/bin/bash
BASEDIR=$(pwd)
function die
{
echo "$1"
exit 1
}
function shunittest_test_environment_separator
{
tdir=$(mktemp -d)
trap "rm -fr ${tdir}" EXIT
cd ${tdir}
git init .
touch README
git add README
git commit -m 'test' README
VERSIONERS_SEPARATOR='X' ${BASEDIR}/taggit.sh
${BASEDIR}/gitversion.sh > version.sh
tag=$(git describe --tags --abbrev=0)
[[ "$tag" == "buildXmasterX0" ]] || die "Tag should be buildXmasterX0, got $tag"
}
function shunittest_test_environment_tagbase
{
tdir=$(mktemp -d)
trap "rm -fr ${tdir}" EXIT
cd ${tdir}
git init .
touch README
git add README
git commit -m 'test' README
VERSIONERS_TAGBASE='release' ${BASEDIR}/taggit.sh
${BASEDIR}/gitversion.sh > version.sh
tag=$(git describe --tags --abbrev=0)
[[ "$tag" == "release,master,0" ]] || die "Tag should be release,master,0, got $tag"
}