| 114 | } |
| 115 | |
| 116 | func TestHashSetNX(t *testing.T) { |
| 117 | server.Clear() |
| 118 | |
| 119 | c, err := proto.Dial(server.Addr()) |
| 120 | ok(t, err) |
| 121 | defer c.Close() |
| 122 | |
| 123 | // New Hash |
| 124 | must1(t, c, "HSETNX", "wim", "zusnx", "jet") |
| 125 | |
| 126 | must0(t, c, "HSETNX", "wim", "zusnx", "jet") |
| 127 | |
| 128 | // Just a new key |
| 129 | must1(t, c, "HSETNX", "wim", "aapnx", "noot") |
| 130 | |
| 131 | // Wrong key type |
| 132 | directDoString(t, c, "SET", "foo", "bar") |
| 133 | mustDo(t, c, |
| 134 | "HSETNX", "foo", "nosuch", "nosuch", |
| 135 | proto.Error("WRONGTYPE Operation against a key holding the wrong kind of value"), |
| 136 | ) |
| 137 | } |
| 138 | |
| 139 | func TestHashMSet(t *testing.T) { |
| 140 | server.Clear() |