mirror of
https://github.com/nalgeon/redka.git
synced 2025-10-27 01:50:28 +08:00
fix: command - always return non-nil command when parsing (fix #27)
To avoid panic when calling pcmd.Error in handlers.parse.
This commit is contained in:
@@ -41,7 +41,7 @@ func TestSetEXParse(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
parse := func(b redis.BaseCmd) (*SetEX, error) {
|
||||
parse := func(b redis.BaseCmd) (SetEX, error) {
|
||||
return ParseSetEX(b, 1000)
|
||||
}
|
||||
|
||||
@@ -53,13 +53,15 @@ func TestSetEXParse(t *testing.T) {
|
||||
testx.AssertEqual(t, cmd.key, test.want.key)
|
||||
testx.AssertEqual(t, cmd.value, test.want.value)
|
||||
testx.AssertEqual(t, cmd.ttl, test.want.ttl)
|
||||
} else {
|
||||
testx.AssertEqual(t, cmd, test.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetEXExec(t *testing.T) {
|
||||
parse := func(b redis.BaseCmd) (*SetEX, error) {
|
||||
parse := func(b redis.BaseCmd) (SetEX, error) {
|
||||
return ParseSetEX(b, 1000)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user