MCPcopy Create free account
hub / github.com/distributedio/titan / TestStringSetThree

Function TestStringSetThree

command/strings_test.go:230–253  ·  view source on GitHub ↗

test set NX|XX|未知

(t *testing.T)

Source from the content-addressed store, hash-verified

228
229// test set NX|XX|未知
230func 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
255func TestStringSet(t *testing.T) {
256

Callers

nothing calls this directly

Calls 5

ContextTestFunction · 0.85
CallFunction · 0.85
ctxStringFunction · 0.85
EqualGetFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected