test set NX|XX|未知
(t *testing.T)
| 228 | |
| 229 | // test set NX|XX|未知 |
| 230 | func TestStringSetThree(t *testing.T) { |
| 231 | args := make([]string, 3) |
| 232 | key := "setxxnxt" |
| 233 | args[0] = key |
| 234 | args[1] = value |
| 235 | args[2] = "nx" |
| 236 | ctx := ContextTest("set", args...) |
| 237 | Call(ctx) |
| 238 | assert.Contains(t, ctxString(ctx.Out), "OK") |
| 239 | EqualGet(t, key, value, nil) |
| 240 | |
| 241 | args[1] = "v1" |
| 242 | args[2] = "xx" |
| 243 | |
| 244 | ctx = ContextTest("set", args...) |
| 245 | Call(ctx) |
| 246 | assert.Contains(t, ctxString(ctx.Out), "OK") |
| 247 | EqualGet(t, key, "v1", nil) |
| 248 | |
| 249 | args[2] = "zx" |
| 250 | ctx = ContextTest("set", args...) |
| 251 | Call(ctx) |
| 252 | assert.Contains(t, ctxString(ctx.Out), ErrSyntax.Error()) |
| 253 | } |
| 254 | |
| 255 | func TestStringSet(t *testing.T) { |
| 256 |
nothing calls this directly
no test coverage detected