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:
Anton
2024-06-09 00:11:47 +05:00
parent ce62018609
commit 2e507f8319
178 changed files with 559 additions and 377 deletions

View File

@@ -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)
}