Skip to content

Commit ef93126

Browse files
authored
Fix MEMORY subcommand casing (#389)
compare case in-sensitive
1 parent 1863d22 commit ef93126

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

cmd_server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ func (m *Miniredis) cmdMemory(c *server.Peer, cmd string, args []string) {
3838
withTx(m, c, func(c *server.Peer, ctx *connCtx) {
3939
db := m.db(ctx.selectedDB)
4040

41-
cmd, args := args[0], args[1:]
41+
cmd, args := strings.ToLower(args[0]), args[1:]
4242
switch cmd {
43-
case "USAGE":
43+
case "usage":
4444
if len(args) < 1 {
4545
setDirty(c)
4646
c.WriteError(errWrongNumber("memory|usage"))

cmd_server_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,13 @@ func TestCmdServerMemoryUsage(t *testing.T) {
139139
proto.Int(124), // normally, with Redis it should be 56 but we don't have the same overhead as Redis
140140
)
141141
}
142+
143+
func TestCmdServerMemoryUsageLowerCase(t *testing.T) {
144+
_, c := runWithClient(t)
145+
146+
c.Do("SET", "foo", "bar")
147+
mustDo(t, c,
148+
"memory", "usage", "foo",
149+
proto.Int(19),
150+
)
151+
}

0 commit comments

Comments
 (0)