MCPcopy
hub / github.com/olric-data/olric / TestProtocol_ParsePutCommand_EX

Function TestProtocol_ParsePutCommand_EX

internal/protocol/dmap_test.go:43–55  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

41}
42
43func TestProtocol_ParsePutCommand_EX(t *testing.T) {
44 putCmd := NewPut("my-dmap", "my-key", []byte("my-value"))
45 putCmd.SetEX((10 * time.Second).Seconds())
46
47 cmd := stringToCommand(putCmd.Command(context.Background()).String())
48 parsed, err := ParsePutCommand(cmd)
49 require.NoError(t, err)
50
51 require.Equal(t, "my-dmap", parsed.DMap)
52 require.Equal(t, "my-key", parsed.Key)
53 require.Equal(t, []byte("my-value"), parsed.Value)
54 require.Equal(t, float64(10), parsed.EX)
55}
56
57func TestProtocol_ParsePutCommand_PX(t *testing.T) {
58 putCmd := NewPut("my-dmap", "my-key", []byte("my-value"))

Callers

nothing calls this directly

Calls 6

SetEXMethod · 0.95
CommandMethod · 0.95
NewPutFunction · 0.85
stringToCommandFunction · 0.85
ParsePutCommandFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected