refactor command command

This commit is contained in:
hdt3213
2023-05-04 23:03:06 +08:00
committed by finley
parent 1e767b6797
commit 68d7f28b1a
15 changed files with 434 additions and 422 deletions

View File

@@ -0,0 +1,20 @@
package database
import (
"github.com/hdt3213/godis/lib/utils"
"github.com/hdt3213/godis/redis/connection"
"github.com/hdt3213/godis/redis/protocol/asserts"
"testing"
)
func TestCommandInfo(t *testing.T) {
c := connection.NewFakeConn()
ret := testServer.Exec(c, utils.ToCmdLine("command"))
asserts.AssertNotError(t, ret)
ret = testServer.Exec(c, utils.ToCmdLine("command", "info", "mset"))
asserts.AssertNotError(t, ret)
ret = testServer.Exec(c, utils.ToCmdLine("command", "getkeys", "mset", "a", "a", "b", "b"))
asserts.AssertMultiBulkReply(t, ret, []string{"a", "b"})
ret = testServer.Exec(c, utils.ToCmdLine("command", "foobar"))
asserts.AssertErrReply(t, ret, "Unknown subcommand or wrong number of arguments for 'foobar'")
}