(t *testing.T)
| 350 | } |
| 351 | |
| 352 | func TestPsetex(t *testing.T) { |
| 353 | server.Clear() |
| 354 | c, err := proto.Dial(server.Addr()) |
| 355 | ok(t, err) |
| 356 | defer c.Close() |
| 357 | s := server.Direct() |
| 358 | |
| 359 | // Usual case |
| 360 | { |
| 361 | mustOK(t, c, |
| 362 | "PSETEX", "aap", "1234", "noot", |
| 363 | ) |
| 364 | s.CheckGet(t, "aap", "noot") |
| 365 | equals(t, time.Millisecond*1234, s.TTL("aap")) |
| 366 | } |
| 367 | |
| 368 | // Same thing |
| 369 | mustOK(t, c, |
| 370 | "PSETEX", "aap", "1234", "noot", |
| 371 | ) |
| 372 | |
| 373 | // Error cases |
| 374 | { |
| 375 | mustDo(t, c, |
| 376 | "PSETEX", "aap", "nottl", "noot", |
| 377 | proto.Error(msgInvalidInt), |
| 378 | ) |
| 379 | mustDo(t, c, |
| 380 | "PSETEX", "aap", |
| 381 | proto.Error(errWrongNumber("psetex")), |
| 382 | ) |
| 383 | mustDo(t, c, |
| 384 | "PSETEX", "aap", "12", |
| 385 | proto.Error(errWrongNumber("psetex")), |
| 386 | ) |
| 387 | mustDo(t, c, |
| 388 | "PSETEX", "aap", "12", "noot", "toomuch", |
| 389 | proto.Error(errWrongNumber("psetex")), |
| 390 | ) |
| 391 | mustDo(t, c, |
| 392 | "PSETEX", "aap", "0", "noot", |
| 393 | proto.Error("ERR invalid expire time in psetex"), |
| 394 | ) |
| 395 | mustDo(t, c, |
| 396 | "PSETEX", "aap", "-10", "noot", |
| 397 | proto.Error("ERR invalid expire time in psetex"), |
| 398 | ) |
| 399 | } |
| 400 | } |
| 401 | |
| 402 | func TestSetnx(t *testing.T) { |
| 403 | server.Clear() |
nothing calls this directly
no test coverage detected