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

Function TestTrim

lists_test.go:403–437  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

401}
402
403func TestTrim(t *testing.T) {
404 c := getTestConn()
405 ctx := context.Background()
406
407 key := []byte("d")
408 if n, err := c.Do(ctx, "rpush", key, 1, 2, 3, 4, 5, 6).Int64(); err != nil {
409 t.Fatal(err)
410 } else if n != 6 {
411 t.Fatal(n)
412 }
413
414 if v, err := c.Do(ctx, "ltrim", key, 2, -1).Text(); err != nil {
415 t.Fatal(err)
416 } else if v != "OK" {
417 t.Fatal(v)
418 }
419
420 if n, err := c.Do(ctx, "llen", key).Int64(); err != nil {
421 t.Fatal(err)
422 } else if n != 4 {
423 t.Fatal(n)
424 }
425
426 if v, err := c.Do(ctx, "ltrim", key, 0, 1).Text(); err != nil {
427 t.Fatal(err)
428 } else if v != "OK" {
429 t.Fatal(v)
430 }
431
432 if n, err := c.Do(ctx, "llen", key).Int64(); err != nil {
433 t.Fatal(err)
434 } else if n != 2 {
435 t.Fatal(n)
436 }
437}
438
439func TestListErrorParams(t *testing.T) {
440 c := getTestConn()

Callers

nothing calls this directly

Calls 2

getTestConnFunction · 0.85
DoMethod · 0.45

Tested by

no test coverage detected