diff --git a/packages/datastructure/lru_cache_test.go b/packages/datastructure/lru_cache_test.go index ac5dbd74c0efa830f940a9f79931e3147fad2e8d..5d314374e9133c30b97e34fcb251ff945f57719d 100644 --- a/packages/datastructure/lru_cache_test.go +++ b/packages/datastructure/lru_cache_test.go @@ -56,9 +56,16 @@ func TestLRUCache(t *testing.T) { t.Error("'b' should have been dropped") } - cache.ComputeIfAbsent("tust", func() interface{} { - return 1337 - }) + { + key, value := "test2", 1337 + + cache.ComputeIfAbsent(key, func() interface{} { + return value + }) + if cache.Get(key) != value { + t.Error("'" + key + "' should have been added") + } + } if cache.GetSize() != 5 { t.Error("the size should be 5")