(t *testing.T)
| 236 | } |
| 237 | |
| 238 | func TestKVSetConditionUnmetReturnsFalse(t *testing.T) { |
| 239 | client, _ := newRedisCommandTestClient(t, func(args []string) string { |
| 240 | if len(args) > 0 && strings.EqualFold(args[0], "SET") { |
| 241 | return "$-1\r\n" |
| 242 | } |
| 243 | return "-ERR unexpected command\r\n" |
| 244 | }) |
| 245 | |
| 246 | written, errSet := client.KVSet(context.Background(), "key", []byte("value"), KVSetOptions{NX: true}) |
| 247 | if errSet != nil { |
| 248 | t.Fatalf("KVSet() error = %v", errSet) |
| 249 | } |
| 250 | if written { |
| 251 | t.Fatalf("KVSet() written = true, want false") |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | func TestKVMSetUsesStableKeyOrder(t *testing.T) { |
| 256 | client, commands := newRedisCommandTestClient(t, func(args []string) string { |
nothing calls this directly
no test coverage detected