MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / TestHashMSet

Function TestHashMSet

IceFireDB-PubSub/test/cmd_hash_test.go:139–175  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

137}
138
139func TestHashMSet(t *testing.T) {
140 server.Clear()
141
142 c, err := proto.Dial(server.Addr())
143 ok(t, err)
144 defer c.Close()
145
146 // New Hash
147 {
148 mustOK(t, c, "HMSET", "hash", "wim", "zus", "jet", "vuur")
149
150 equals(t, "zus", directDoString(t, c, "HGET", "hash", "wim"))
151 equals(t, "vuur", directDoString(t, c, "HGET", "hash", "jet"))
152 }
153
154 // Doesn't touch ttl.
155 {
156 i, _ := directDoIntErr(t, c, "EXPIRE", "hash", 999)
157 equals(t, i, 1)
158 mustOK(t, c, "HMSET", "hash", "gijs", "lam")
159 time, err := directDoIntErr(t, c, "TTL", "hash")
160
161 equals(t, 999, time)
162 equals(t, nil, err)
163 }
164
165 {
166 // Wrong key type
167 directDoString(t, c, "SET", "str", "value")
168 mustDo(t, c, "HMSET", "str", "key", "value", proto.Error("WRONGTYPE Operation against a key holding the wrong kind of value"))
169
170 // Usage error
171 mustDo(t, c, "HMSET", "str", proto.Error(errWrongNumber("HMSET")))
172 mustDo(t, c, "HMSET", "str", "odd", proto.Error(errWrongNumber("HMSET")))
173 mustDo(t, c, "HMSET", "str", "key", "value", "odd", proto.Error(errWrongNumber("HMSET")))
174 }
175}
176
177func TestHashDel(t *testing.T) {
178 server.Clear()

Callers

nothing calls this directly

Calls 12

ClearFunction · 0.92
DialFunction · 0.92
AddrFunction · 0.92
ErrorFunction · 0.92
okFunction · 0.70
mustOKFunction · 0.70
equalsFunction · 0.70
directDoStringFunction · 0.70
directDoIntErrFunction · 0.70
mustDoFunction · 0.70
errWrongNumberFunction · 0.70
CloseMethod · 0.65

Tested by

no test coverage detected