mirror of
https://github.com/reecetech/version-increment.git
synced 2025-12-21 14:35:44 +00:00
Fix tests
This commit is contained in:
@@ -5,6 +5,15 @@ load helper_print-info
|
|||||||
|
|
||||||
export repo=".tmp_testing/repo"
|
export repo=".tmp_testing/repo"
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
# get the containing directory of this file
|
||||||
|
# use $BATS_TEST_FILENAME instead of ${BASH_SOURCE[0]} or $0,
|
||||||
|
# as those will point to the bats executable's location or the preprocessed file respectively
|
||||||
|
DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )"
|
||||||
|
# make executables in src/ visible to PATH
|
||||||
|
PATH="$DIR/../:$PATH"
|
||||||
|
}
|
||||||
|
|
||||||
function init_repo {
|
function init_repo {
|
||||||
rm -rf "${repo}" &&
|
rm -rf "${repo}" &&
|
||||||
mkdir -p "${repo}" &&
|
mkdir -p "${repo}" &&
|
||||||
@@ -22,7 +31,7 @@ function init_repo {
|
|||||||
|
|
||||||
export scheme="foover"
|
export scheme="foover"
|
||||||
|
|
||||||
run ../../version-lookup.sh
|
run version-lookup.sh
|
||||||
|
|
||||||
print_run_info
|
print_run_info
|
||||||
[ "$status" -eq 8 ] &&
|
[ "$status" -eq 8 ] &&
|
||||||
@@ -30,7 +39,7 @@ function init_repo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "no deprecated set-output calls made" {
|
@test "no deprecated set-output calls made" {
|
||||||
run grep -q "::set-output" version-lookup.sh
|
run grep -q "::set-output" ../version-lookup.sh
|
||||||
|
|
||||||
print_run_info
|
print_run_info
|
||||||
[ "$status" -eq 1 ]
|
[ "$status" -eq 1 ]
|
||||||
@@ -43,7 +52,7 @@ function init_repo {
|
|||||||
git tag 0.1.1
|
git tag 0.1.1
|
||||||
git tag 0.1.2
|
git tag 0.1.2
|
||||||
|
|
||||||
run ../../version-lookup.sh
|
run version-lookup.sh
|
||||||
|
|
||||||
print_run_info
|
print_run_info
|
||||||
[ "$status" -eq 0 ] &&
|
[ "$status" -eq 0 ] &&
|
||||||
@@ -55,7 +64,7 @@ function init_repo {
|
|||||||
|
|
||||||
git tag 0.1.2
|
git tag 0.1.2
|
||||||
|
|
||||||
run ../../version-lookup.sh
|
run version-lookup.sh
|
||||||
|
|
||||||
print_run_info
|
print_run_info
|
||||||
[ "$status" -eq 0 ] &&
|
[ "$status" -eq 0 ] &&
|
||||||
@@ -69,7 +78,7 @@ function init_repo {
|
|||||||
git tag 1.2.300
|
git tag 1.2.300
|
||||||
git tag 1.2.301-dev.234
|
git tag 1.2.301-dev.234
|
||||||
|
|
||||||
run ../../version-lookup.sh
|
run version-lookup.sh
|
||||||
|
|
||||||
print_run_info
|
print_run_info
|
||||||
[ "$status" -eq 0 ] &&
|
[ "$status" -eq 0 ] &&
|
||||||
@@ -79,7 +88,7 @@ function init_repo {
|
|||||||
@test "returns 0.0.0 if no normal version detected" {
|
@test "returns 0.0.0 if no normal version detected" {
|
||||||
init_repo
|
init_repo
|
||||||
|
|
||||||
run ../../version-lookup.sh
|
run version-lookup.sh
|
||||||
|
|
||||||
print_run_info
|
print_run_info
|
||||||
[ "$status" -eq 0 ] &&
|
[ "$status" -eq 0 ] &&
|
||||||
@@ -91,7 +100,7 @@ function init_repo {
|
|||||||
|
|
||||||
git tag 0.0.1-dev.999
|
git tag 0.0.1-dev.999
|
||||||
|
|
||||||
run ../../version-lookup.sh
|
run version-lookup.sh
|
||||||
|
|
||||||
print_run_info
|
print_run_info
|
||||||
[ "$status" -eq 0 ] &&
|
[ "$status" -eq 0 ] &&
|
||||||
@@ -103,7 +112,7 @@ function init_repo {
|
|||||||
|
|
||||||
export scheme="calver"
|
export scheme="calver"
|
||||||
|
|
||||||
run ../../version-lookup.sh
|
run version-lookup.sh
|
||||||
|
|
||||||
print_run_info
|
print_run_info
|
||||||
[ "$status" -eq 0 ] &&
|
[ "$status" -eq 0 ] &&
|
||||||
@@ -115,7 +124,7 @@ function init_repo {
|
|||||||
|
|
||||||
git tag v3.4.5
|
git tag v3.4.5
|
||||||
|
|
||||||
run ../../version-lookup.sh
|
run version-lookup.sh
|
||||||
|
|
||||||
print_run_info
|
print_run_info
|
||||||
[ "$status" -eq 0 ] &&
|
[ "$status" -eq 0 ] &&
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ if [[ -z "${current_version:-}" ]] ; then
|
|||||||
current_version="0.0.0"
|
current_version="0.0.0"
|
||||||
;;
|
;;
|
||||||
calver)
|
calver)
|
||||||
current_version="$(date '+%Y.%-m.1')"
|
current_version="$(date '+%Y.%-m.0')"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user