Update go dependencies
This commit is contained in:
parent
a858c549d9
commit
f3bde94d68
643 changed files with 14296 additions and 19354 deletions
24
vendor/github.com/golang/groupcache/lru/lru_test.go
generated
vendored
24
vendor/github.com/golang/groupcache/lru/lru_test.go
generated
vendored
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||
package lru
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
|
@ -71,3 +72,26 @@ func TestRemove(t *testing.T) {
|
|||
t.Fatal("TestRemove returned a removed entry")
|
||||
}
|
||||
}
|
||||
|
||||
func TestEvict(t *testing.T) {
|
||||
evictedKeys := make([]Key, 0)
|
||||
onEvictedFun := func(key Key, value interface{}) {
|
||||
evictedKeys = append(evictedKeys, key)
|
||||
}
|
||||
|
||||
lru := New(20)
|
||||
lru.OnEvicted = onEvictedFun
|
||||
for i := 0; i < 22; i++ {
|
||||
lru.Add(fmt.Sprintf("myKey%d", i), 1234)
|
||||
}
|
||||
|
||||
if len(evictedKeys) != 2 {
|
||||
t.Fatalf("got %d evicted keys; want 2", len(evictedKeys))
|
||||
}
|
||||
if evictedKeys[0] != Key("myKey0") {
|
||||
t.Fatalf("got %v in first evicted key; want %s", evictedKeys[0], "myKey0")
|
||||
}
|
||||
if evictedKeys[1] != Key("myKey1") {
|
||||
t.Fatalf("got %v in second evicted key; want %s", evictedKeys[1], "myKey1")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue