修复RedisCommand BUG + 增加单元测试
This commit is contained in:
29
redis_test.go
Normal file
29
redis_test.go
Normal file
@ -0,0 +1,29 @@
|
||||
// Package consts ...
|
||||
//
|
||||
// Description : consts ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2025-04-20 13:29
|
||||
package consts
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// RedisCmd_String 序列换 RedisCmd
|
||||
func TestRedisCmd_String(t *testing.T) {
|
||||
Convey("redis cmd字符串值", t, func() {
|
||||
byteData, err := json.Marshal(RedisCommandSet)
|
||||
So(err, ShouldBeNil)
|
||||
So(RedisCommandSet.String(), ShouldEqual, "SET")
|
||||
So(string(byteData), ShouldEqual, `"SET"`)
|
||||
})
|
||||
Convey("redis cmd MarshalJSON", t, func() {
|
||||
str, err := RedisCommandSet.MarshalJSON()
|
||||
So(err, ShouldBeNil)
|
||||
So(string(str), ShouldEqual, `SET`)
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user