Create & Init Project...
This commit is contained in:
26
library/cache/memcache/util_test.go
vendored
Normal file
26
library/cache/memcache/util_test.go
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
package memcache
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
pb "go-common/library/cache/memcache/test"
|
||||
)
|
||||
|
||||
func TestItemUtil(t *testing.T) {
|
||||
item1 := RawItem("test", []byte("hh"), 0, 0)
|
||||
assert.Equal(t, "test", item1.Key)
|
||||
assert.Equal(t, []byte("hh"), item1.Value)
|
||||
assert.Equal(t, FlagRAW, FlagRAW&item1.Flags)
|
||||
|
||||
item1 = JSONItem("test", &Item{}, 0, 0)
|
||||
assert.Equal(t, "test", item1.Key)
|
||||
assert.NotNil(t, item1.Object)
|
||||
assert.Equal(t, FlagJSON, FlagJSON&item1.Flags)
|
||||
|
||||
item1 = ProtobufItem("test", &pb.TestItem{}, 0, 0)
|
||||
assert.Equal(t, "test", item1.Key)
|
||||
assert.NotNil(t, item1.Object)
|
||||
assert.Equal(t, FlagProtobuf, FlagProtobuf&item1.Flags)
|
||||
}
|
Reference in New Issue
Block a user