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

Function TestRPushPop

IceFireDB-PubSub/test/cmd_list_test.go:283–354  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

281}
282
283func TestRPushPop(t *testing.T) {
284 server.Clear()
285 c, err := proto.Dial(server.Addr())
286 ok(t, err)
287 defer c.Close()
288 s := server.Direct()
289 {
290 mustDo(t, c,
291 "RPUSH", "l", "aap", "noot", "mies",
292 proto.Int(3),
293 )
294
295 mustDo(t, c,
296 "LRANGE", "l", "0", "0",
297 proto.Strings("aap"),
298 )
299
300 mustDo(t, c,
301 "LRANGE", "l", "-1", "-1",
302 proto.Strings("mies"),
303 )
304 }
305
306 // Push more.
307 {
308 mustDo(t, c,
309 "RPUSH", "l", "aap2", "noot2", "mies2",
310 proto.Int(6),
311 )
312
313 mustDo(t, c,
314 "LRANGE", "l", "0", "0",
315 proto.Strings("aap"),
316 )
317
318 mustDo(t, c,
319 "LRANGE", "l", "-1", "-1",
320 proto.Strings("mies2"),
321 )
322 }
323
324 // Direct usage
325 {
326 l, err := s.Push("l2", "a")
327 ok(t, err)
328 equals(t, 1, l)
329 l, err = s.Push("l2", "b")
330 ok(t, err)
331 equals(t, 2, l)
332 list, err := s.List("l2")
333 ok(t, err)
334 equals(t, []string{"a", "b"}, list)
335
336 el, err := s.Pop("l2")
337 ok(t, err)
338 equals(t, "b", el)
339 el, err = s.Pop("l2")
340 ok(t, err)

Callers

nothing calls this directly

Calls 12

ClearFunction · 0.92
DialFunction · 0.92
AddrFunction · 0.92
DirectFunction · 0.92
IntFunction · 0.92
StringsFunction · 0.92
ErrorFunction · 0.92
okFunction · 0.70
mustDoFunction · 0.70
equalsFunction · 0.70
mustOKFunction · 0.70
CloseMethod · 0.65

Tested by

no test coverage detected