execute command in a go routine. Used to test blocking commands.
(t *testing.T, s *miniredis.Miniredis, args ...string)
| 32 | |
| 33 | // execute command in a go routine. Used to test blocking commands. |
| 34 | func goStrings(t *testing.T, s *miniredis.Miniredis, args ...string) <-chan string { |
| 35 | c, err := proto.Dial(s.Addr()) |
| 36 | ok(t, err) |
| 37 | |
| 38 | got := make(chan string, 1) |
| 39 | go func() { |
| 40 | defer c.Close() |
| 41 | defer close(got) |
| 42 | res, err := c.Do(args...) |
| 43 | if err != nil { |
| 44 | t.Error(err.Error()) |
| 45 | return |
| 46 | } |
| 47 | got <- res |
| 48 | }() |
| 49 | return got |
| 50 | } |
| 51 | |
| 52 | func TestLpush(t *testing.T) { |
| 53 | server.Clear() |