MCPcopy
hub / github.com/redis/go-redis / TestIncrEXInt_Args

Function TestIncrEXInt_Args

string_commands_unit_test.go:19–118  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

17}
18
19func TestIncrEXInt_Args(t *testing.T) {
20 tests := []struct {
21 name string
22 args IncrEXIntArgs
23 want []interface{}
24 }{
25 {
26 name: "default",
27 args: IncrEXIntArgs{},
28 want: []interface{}{"increx", "key"},
29 },
30 {
31 name: "byint",
32 args: IncrEXIntArgs{By: 4, HasBy: true},
33 want: []interface{}{"increx", "key", "byint", int64(4)},
34 },
35 {
36 name: "byint_zero_explicit",
37 args: IncrEXIntArgs{By: 0, HasBy: true},
38 want: []interface{}{"increx", "key", "byint", int64(0)},
39 },
40 {
41 name: "lbound_ubound",
42 args: IncrEXIntArgs{
43 By: 2, HasBy: true,
44 LBound: 0, HasLBound: true,
45 UBound: 20, HasUBound: true,
46 },
47 want: []interface{}{"increx", "key", "byint", int64(2), "lbound", int64(0), "ubound", int64(20)},
48 },
49 {
50 name: "lbound_zero_is_sent",
51 args: IncrEXIntArgs{
52 LBound: 0, HasLBound: true,
53 },
54 want: []interface{}{"increx", "key", "lbound", int64(0)},
55 },
56 {
57 name: "ex_and_enx",
58 args: IncrEXIntArgs{
59 By: 2, HasBy: true,
60 Expiration: &ExpirationOption{Mode: EX, Value: 60},
61 ENX: true,
62 },
63 want: []interface{}{"increx", "key", "byint", int64(2), "ex", int64(60), "enx"},
64 },
65 {
66 name: "px",
67 args: IncrEXIntArgs{Expiration: &ExpirationOption{Mode: PX, Value: 1500}},
68 want: []interface{}{"increx", "key", "px", int64(1500)},
69 },
70 {
71 name: "exat",
72 args: IncrEXIntArgs{Expiration: &ExpirationOption{Mode: EXAT, Value: 1753265054}},
73 want: []interface{}{"increx", "key", "exat", int64(1753265054)},
74 },
75 {
76 name: "pxat",

Callers

nothing calls this directly

Calls 4

captureCmdableFunction · 0.85
IncrEXIntMethod · 0.65
ArgsMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected