* func TestGetdel(t *testing.T) { server.Clear() c, err := proto.Dial(server.Addr()) ok(t, err) defer c.Close() s := server.Direct() // Missing key { mustNil(t, c, "GETDEL", "foo") } // Existing key { s.Set("foo", "bar") mustDo(t, c, "GETDEL", "foo", proto.Str
(t *testing.T)
| 875 | } |
| 876 | */ |
| 877 | func TestStrlen(t *testing.T) { |
| 878 | server.Clear() |
| 879 | c, err := proto.Dial(server.Addr()) |
| 880 | ok(t, err) |
| 881 | defer c.Close() |
| 882 | s := server.Direct() |
| 883 | |
| 884 | // Existing key |
| 885 | { |
| 886 | s.Set("foo", "bar!") |
| 887 | mustDo(t, c, |
| 888 | "STRLEN", "foo", |
| 889 | proto.Int(4), |
| 890 | ) |
| 891 | } |
| 892 | |
| 893 | // New key |
| 894 | { |
| 895 | must0(t, c, |
| 896 | "STRLEN", "nosuch", |
| 897 | ) |
| 898 | } |
| 899 | |
| 900 | // Wrong type of existing key |
| 901 | { |
| 902 | s.HSet("wrong", "aap", "noot") |
| 903 | mustDo(t, c, |
| 904 | "STRLEN", "wrong", |
| 905 | proto.Error(msgWrongType), |
| 906 | ) |
| 907 | } |
| 908 | |
| 909 | // Wrong usage |
| 910 | { |
| 911 | mustDo(t, c, |
| 912 | "STRLEN", |
| 913 | proto.Error(errWrongNumber("strlen")), |
| 914 | ) |
| 915 | mustDo(t, c, |
| 916 | "STRLEN", "spurious", "arguments", |
| 917 | proto.Error(errWrongNumber("strlen")), |
| 918 | ) |
| 919 | } |
| 920 | } |
| 921 | |
| 922 | func TestAppend(t *testing.T) { |
| 923 | server.Clear() |
nothing calls this directly
no test coverage detected