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

Function TestMset

IceFireDB-PubSub/test/cmd_string_test.go:257–300  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

255}
256
257func TestMset(t *testing.T) {
258 server.Clear()
259 c, err := proto.Dial(server.Addr())
260 ok(t, err)
261 defer c.Close()
262 s := server.Direct()
263
264 {
265 mustOK(t, c,
266 "MSET", "zus", "jet", "teun", "vuur", "gijs", "lam",
267 )
268 s.CheckGet(t, "zus", "jet")
269 s.CheckGet(t, "teun", "vuur")
270 s.CheckGet(t, "gijs", "lam")
271 }
272
273 // Other types are overwritten
274 {
275 s.HSet("aap", "foo", "bar")
276 mustOK(t, c,
277 "MSET", "aap", "jet",
278 )
279 s.CheckGet(t, "aap", "jet")
280 }
281
282 // Odd argument list is not OK
283 mustDo(t, c,
284 "MSET", "zus", "jet", "teun",
285 proto.Error("ERR wrong number of arguments for 'MSET' command"),
286 )
287
288 // TTL is cleared
289 {
290 s.Set("foo", "bar")
291 s.HSet("aap", "foo", "bar") // even for weird keys.
292 s.SetTTL("aap", time.Second*999)
293 s.SetTTL("foo", time.Second*999)
294 mustOK(t, c,
295 "MSET", "aap", "noot", "foo", "baz",
296 )
297 equals(t, time.Duration(0), s.TTL("aap"))
298 equals(t, time.Duration(0), s.TTL("foo"))
299 }
300}
301
302func TestSetex(t *testing.T) {
303 server.Clear()

Callers

nothing calls this directly

Calls 11

ClearFunction · 0.92
DialFunction · 0.92
AddrFunction · 0.92
DirectFunction · 0.92
ErrorFunction · 0.92
SetMethod · 0.80
okFunction · 0.70
mustOKFunction · 0.70
mustDoFunction · 0.70
equalsFunction · 0.70
CloseMethod · 0.65

Tested by

no test coverage detected