summaryrefslogtreecommitdiff
path: root/cache/cache_test.go
diff options
context:
space:
mode:
authorewy <ewy0@protonmail.com>2026-04-16 22:48:32 +0200
committerewy <ewy0@protonmail.com>2026-04-16 22:48:32 +0200
commitfbdc2b9d849913ccf8dd7a9001012ce2d28cbd2f (patch)
treef2e08dfcae638a42424742d914053ce2607ab76a /cache/cache_test.go
parent6a22a1ee7bfd1fbd34486a224db98eb6aead5c3e (diff)
when reindexing in --all, only index "added" sources
Diffstat (limited to 'cache/cache_test.go')
-rw-r--r--cache/cache_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/cache/cache_test.go b/cache/cache_test.go
index fa81974..c140154 100644
--- a/cache/cache_test.go
+++ b/cache/cache_test.go
@@ -77,3 +77,17 @@ func TestFromReader_Comments(t *testing.T) {
Label: "da source",
})
}
+
+func TestStrip(t *testing.T) {
+ c := Cache{Entries: []Entry{{"/asdf/123", ""}, {"xxxxx", "lab"}}}
+ remove := Cache{Entries: []Entry{{"xxxxx", "wronglabel"}}}
+ result := c.Strip(remove)
+ assert.Equal(t, Cache{Entries: []Entry{{"/asdf/123", ""}}}, result)
+}
+
+func TestStrip_Nothing(t *testing.T) {
+ c := Cache{Entries: []Entry{{"/asdf/123", ""}, {"/asdf/123", ""}}}
+ old := Cache{}
+ result := c.Strip(old)
+ assert.Equal(t, c, result)
+}