b2: fix versions and .files with no extension - fixes #5244

This commit is contained in:
Nick Craig-Wood
2021-04-19 16:48:51 +01:00
parent 82f1f7d2c4
commit 06f27384dd
2 changed files with 18 additions and 4 deletions

View File

@ -26,6 +26,8 @@ func TestVersionAdd(t *testing.T) {
{t0, "potato-v2001-02-03-040506-123.txt", "potato-v2001-02-03-040506-123-v1970-01-01-010101-123.txt"},
{t0, "123.!!lipps", "123-v1970-01-01-010101-123.!!lipps"},
{t1, "potato", "potato-v2001-02-03-040506-123"},
{t1, ".potato", ".potato-v2001-02-03-040506-123"},
{t1, ".potato.conf", ".potato-v2001-02-03-040506-123.conf"},
{t1, "", "-v2001-02-03-040506-123"},
} {
actual := version.Add(test.in, test.t)
@ -43,6 +45,8 @@ func TestVersionRemove(t *testing.T) {
{"potato-v1970-01-01-010101-123.txt", t0r, "potato.txt"},
{"potato-v2001-02-03-040506-123-v1970-01-01-010101-123.txt", t0r, "potato-v2001-02-03-040506-123.txt"},
{"potato-v2001-02-03-040506-123", t1, "potato"},
{".potato-v2001-02-03-040506-123", t1, ".potato"},
{".potato-v2001-02-03-040506-123.conf", t1, ".potato.conf"},
{"-v2001-02-03-040506-123", t1, ""},
{"potato-v2A01-02-03-040506-123", emptyT, "potato-v2A01-02-03-040506-123"},
{"potato-v2001-02-03-040506=123", emptyT, "potato-v2001-02-03-040506=123"},