Skip to content

Commit

Permalink
Add test to verify DiskLruCache entries persist deletion without flush.
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrtwhite committed Nov 14, 2024
1 parent f93ac43 commit d6e848a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions coil-core/src/commonTest/kotlin/coil3/disk/DiskLruCacheTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1118,6 +1118,25 @@ class DiskLruCacheTest {
assertEquals(0L, cache.size())
}

@Test
fun evictAllDeletesAllEntriesInJournalWithoutFlush() {
set("a", "a", "a")
set("b", "b", "b")
set("c", "c", "c")

cache.evictAll()
assertAbsent("a")
assertAbsent("b")
assertAbsent("c")
assertEquals(0, cache.size())

createNewCache()
assertAbsent("a")
assertAbsent("b")
assertAbsent("c")
assertEquals(0, cache.size())
}

@Test
fun editSnapshotAfterEvictAllReturnsNullDueToStaleValue() {
val expectedByteCount = 2L
Expand Down

0 comments on commit d6e848a

Please sign in to comment.