From 8234bea43ea313cbee8b12c38e6d0e22795c107e Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 11 Dec 2024 23:18:45 +0200 Subject: Add entry name --- internal/entry/entry_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'internal/entry/entry_test.go') diff --git a/internal/entry/entry_test.go b/internal/entry/entry_test.go index f9df524..1d6cde3 100644 --- a/internal/entry/entry_test.go +++ b/internal/entry/entry_test.go @@ -40,6 +40,26 @@ func TestEntry(t *testing.T) { } } +func TestEntryName(t *testing.T) { + table := map[string]string{ + "/foo/bar/baz.txt": "baz.txt", + "/foo/bar/baz.foo.txt": "baz.foo.txt", + "/foo/bar/baz.foo.txt.20250101-010101.posted": "baz.foo.txt", + "/foo/bar/baz.foo.txt.20250101-010101.queued": "baz.foo.txt", + } + + for path, expectedName := range table { + en, err := New(path) + if err != nil { + t.Error(err) + } + if en.Name() != expectedName { + t.Errorf("expected entry name '%s' but got '%s' for path '%s'", + expectedName, en.Name(), path) + } + } +} + func TestEntryTags(t *testing.T) { tagss := []string{"prio", "share:linkedin:mastodon.now", "share:-mastodon", "ask", "invalid"} -- cgit v1.2.3