25 lines
338 B
Go
25 lines
338 B
Go
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")
|
|
}
|
|
}
|