(t *testing.T)
| 249 | } |
| 250 | |
| 251 | func TestHashKeys(t *testing.T) { |
| 252 | server.Clear() |
| 253 | |
| 254 | c, err := proto.Dial(server.Addr()) |
| 255 | ok(t, err) |
| 256 | defer c.Close() |
| 257 | mustOK(t, c, "HMSET", "wim", |
| 258 | "gijs", "lam", |
| 259 | "kees", "bok", |
| 260 | "teun", "vuur", |
| 261 | "zus", "jet") |
| 262 | |
| 263 | mustDo(t, c, |
| 264 | "HKEYS", "wim", |
| 265 | proto.Strings( |
| 266 | "gijs", |
| 267 | "kees", |
| 268 | "teun", |
| 269 | "zus", |
| 270 | ), |
| 271 | ) |
| 272 | |
| 273 | t.Run("direct", func(t *testing.T) { |
| 274 | direct, err := directDoStringArrErr(t, c, "HKEYS", "wim") |
| 275 | ok(t, err) |
| 276 | equals(t, []string{ |
| 277 | "gijs", |
| 278 | "kees", |
| 279 | "teun", |
| 280 | "zus", |
| 281 | }, direct) |
| 282 | res, err := directDoStringArrErr(t, c, "HKEYS", "nosuch") |
| 283 | equals(t, err, nil) |
| 284 | equals(t, len(res), 0) |
| 285 | }) |
| 286 | |
| 287 | mustDo(t, c, "HKEYS", "nosuch", proto.Strings()) |
| 288 | |
| 289 | // Wrong key type |
| 290 | directDoString(t, c, "SET", "foo", "bar") |
| 291 | mustDo(t, c, "HKEYS", "foo", proto.Error(msgWrongType)) |
| 292 | } |
| 293 | |
| 294 | func TestHashValues(t *testing.T) { |
| 295 | server.Clear() |
nothing calls this directly
no test coverage detected