kos/pkg/cache/instance_test.go

25 lines
338 B
Go
Raw Normal View History

2023-09-20 11:05:08 +08:00
package cache
import (
"context"
"testing"
)
func TestStore(t *testing.T) {
ctx := context.Background()
var (
n int
name string
)
Store(ctx, "age", 1)
Load(ctx, "age", &n)
if n != 1 {
t.Errorf("not equal")
}
Store(ctx, "name", "zhansan")
Load(ctx, "name", &name)
if name != "zhansan" {
t.Errorf("not equal")
}
}