Files
redis-go/database/commandinfo_test.go
2023-05-20 16:20:44 +08:00

21 lines
712 B
Go

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 'foobar'")
}