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

Function TestSKeyExists

set_test.go:300–317  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

298}
299
300func TestSKeyExists(t *testing.T) {
301 db := getTestConn()
302 ctx := context.Background()
303 key := "skeyexists_test"
304 if n, err := db.Do(ctx, "SKeyExists", key).Result(); err != nil {
305 t.Fatal(err.Error())
306 } else if n, ok := n.(int64); !ok || n != 0 {
307 t.Fatal("invalid value ", n)
308 }
309
310 db.SAdd(ctx, key, "hello", "world")
311
312 if n, err := db.Do(ctx, "SKeyExists", key).Result(); err != nil {
313 t.Fatal(err.Error())
314 } else if n, ok := n.(int64); !ok || n != 1 {
315 t.Fatal("invalid value ", n)
316 }
317}

Callers

nothing calls this directly

Calls 3

getTestConnFunction · 0.85
DoMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected