From 9827378121f1fc800171e84e4a9660615cb1f1db Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 27 Oct 2024 21:50:28 +0200 Subject: add HasTag --- internal/entry/entry_test.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'internal/entry/entry_test.go') diff --git a/internal/entry/entry_test.go b/internal/entry/entry_test.go index 43c2243..c59dc16 100644 --- a/internal/entry/entry_test.go +++ b/internal/entry/entry_test.go @@ -80,6 +80,28 @@ func TestExtractURLs(t *testing.T) { } } +func TestHasTag(t *testing.T) { + // TODO: Remove t.Parallel() everywhere + table := map[string][]string{ + "foo.txt": []string{}, + "foo.prio.txt": []string{"prio"}, + "foo.ask.prio.txt": []string{"prio", "ask"}, + "prio.foo.ask.txt": []string{"prio", "ask"}, + } + + for fileName, expectedTags := range table { + ent, err := New(fileName) + if err != nil { + t.Error(err) + } + for _, tag := range expectedTags { + if !ent.HasTag(tag) { + t.Errorf("expected tag '%s' but got '%s'", tag, ent.tags) + } + } + } +} + func FuzzExtractURLs(f *testing.F) { f.Add("/path?myjfa=lwsr4imj&dgqeg=m3uwwsak") f.Add("/?amfbm=bwzqu46m&xheuh=nv588d98") -- cgit v1.2.3