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

Function TestHashKeys

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

Source from the content-addressed store, hash-verified

249}
250
251func TestHashKeys(t *testing.T) {
252 server.Clear()
253
254 c, err := proto.Dial(server.Addr())
255 ok(t, err)
256 defer c.Close()
257 mustOK(t, c, "HMSET", "wim",
258 "gijs", "lam",
259 "kees", "bok",
260 "teun", "vuur",
261 "zus", "jet")
262
263 mustDo(t, c,
264 "HKEYS", "wim",
265 proto.Strings(
266 "gijs",
267 "kees",
268 "teun",
269 "zus",
270 ),
271 )
272
273 t.Run("direct", func(t *testing.T) {
274 direct, err := directDoStringArrErr(t, c, "HKEYS", "wim")
275 ok(t, err)
276 equals(t, []string{
277 "gijs",
278 "kees",
279 "teun",
280 "zus",
281 }, direct)
282 res, err := directDoStringArrErr(t, c, "HKEYS", "nosuch")
283 equals(t, err, nil)
284 equals(t, len(res), 0)
285 })
286
287 mustDo(t, c, "HKEYS", "nosuch", proto.Strings())
288
289 // Wrong key type
290 directDoString(t, c, "SET", "foo", "bar")
291 mustDo(t, c, "HKEYS", "foo", proto.Error(msgWrongType))
292}
293
294func TestHashValues(t *testing.T) {
295 server.Clear()

Callers

nothing calls this directly

Calls 13

ClearFunction · 0.92
DialFunction · 0.92
AddrFunction · 0.92
StringsFunction · 0.92
ErrorFunction · 0.92
okFunction · 0.70
mustOKFunction · 0.70
mustDoFunction · 0.70
directDoStringArrErrFunction · 0.70
equalsFunction · 0.70
directDoStringFunction · 0.70
CloseMethod · 0.65

Tested by

no test coverage detected