summaryrefslogtreecommitdiff
path: root/internal/entry/entry_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-10-27 21:50:28 +0200
committerPaul Buetow <paul@buetow.org>2024-10-27 21:50:28 +0200
commit9827378121f1fc800171e84e4a9660615cb1f1db (patch)
treea2978d493e1e7e996dab28dcb7304fa4abb23952 /internal/entry/entry_test.go
parent10eb852c01e84619340290d1cbaba0b116dd3267 (diff)
add HasTag
Diffstat (limited to 'internal/entry/entry_test.go')
-rw-r--r--internal/entry/entry_test.go22
1 files changed, 22 insertions, 0 deletions
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")