From f275de0d597b4c13a6d4520faa3fdec309ca91a3 Mon Sep 17 00:00:00 2001 From: Phil Jay Date: Mon, 10 Aug 2026 15:11:45 +1000 Subject: [PATCH] Expose parsing errors --- tests/test_version-lookup.bats | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/test_version-lookup.bats b/tests/test_version-lookup.bats index ebb03f1..ff6082d 100644 --- a/tests/test_version-lookup.bats +++ b/tests/test_version-lookup.bats @@ -103,6 +103,35 @@ function init_repo { [[ "$output" = *"CURRENT_V_VERSION=v0.1.2"* ]] } +@test "treats tag_prefix as a literal string" { + init_repo + + export tag_prefix="v." + + git tag v.1.2.3 + git tag v1.9.9 + + run version-lookup.sh + + print_run_info + [ "$status" -eq 0 ] && + [[ "$output" = *"CURRENT_VERSION=1.2.3"* ]] +} + +@test "supports a tag_prefix containing a sed delimiter" { + init_repo + + export tag_prefix="foo|bar@" + + git tag "foo|bar@1.2.3" + + run version-lookup.sh + + print_run_info + [ "$status" -eq 0 ] && + [[ "$output" = *"CURRENT_VERSION=1.2.3"* ]] +} + @test "finds the current normal version even if there's a newer pre-release version" { init_repo