| 446 | } |
| 447 | |
| 448 | func TestLlen(t *testing.T) { |
| 449 | server.Clear() |
| 450 | c, err := proto.Dial(server.Addr()) |
| 451 | ok(t, err) |
| 452 | defer c.Close() |
| 453 | s := server.Direct() |
| 454 | s.Push("l", "aap", "noot", "mies", "vuur") |
| 455 | |
| 456 | mustDo(t, c, |
| 457 | "LLEN", "l", |
| 458 | proto.Int(4), |
| 459 | ) |
| 460 | |
| 461 | // Non existing key |
| 462 | must0(t, c, |
| 463 | "LLEN", "nonexisting", |
| 464 | ) |
| 465 | |
| 466 | // Wrong type of key |
| 467 | mustOK(t, c, "SET", "str", "value") |
| 468 | mustDo(t, c, |
| 469 | "LLEN", "str", |
| 470 | proto.Error(msgWrongType), |
| 471 | ) |
| 472 | |
| 473 | // Too many arguments |
| 474 | mustDo(t, c, |
| 475 | "LLEN", "too", "many", |
| 476 | proto.Error("ERR wrong number of arguments for 'llen' command"), |
| 477 | ) |
| 478 | } |
| 479 | |
| 480 | func TestLtrim(t *testing.T) { |
| 481 | server.Clear() |