blob: d1b91bf5de454fd51d92a220514eb98a7e1526bd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
package nvdmirror
import "testing"
func TestFailSetCache(t *testing.T) {
var data map[string]string
var cache FailSetCache
// test get
t.Run("Get", func(t *testing.T) {
if got, ok := cache.Get("foo"); ok {
t.Errorf("got %v, exp !ok", got)
}
})
// test set
t.Run("Set", func(t *testing.T) {
if err := cache.Set("bar", data); err == nil {
t.Errorf("got success, exp err")
}
})
// test delete
t.Run("Delete", func(t *testing.T) {
if err := cache.Delete("foo"); err != nil {
t.Error(err)
}
})
// test Close
t.Run("Close", func(t *testing.T) {
if err := cache.Close(); err != nil {
t.Error(err)
}
})
}
|