mirror of
https://github.com/redis/go-redis.git
synced 2025-07-28 06:42:00 +03:00
chore: set the default value for the options.protocol
in the init()
of options
(#3387)
* chore: set the default value for the `options.protocol` in the `init()` of `options` Signed-off-by: fukua95 <fukua95@gmail.com> * add a test Signed-off-by: fukua95 <fukua95@gmail.com> --------- Signed-off-by: fukua95 <fukua95@gmail.com>
This commit is contained in:
@ -222,3 +222,26 @@ func TestReadTimeoutOptions(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestProtocolOptions(t *testing.T) {
|
||||
testCasesMap := map[int]int{
|
||||
0: 3,
|
||||
1: 3,
|
||||
2: 2,
|
||||
3: 3,
|
||||
}
|
||||
|
||||
o := &Options{}
|
||||
o.init()
|
||||
if o.Protocol != 3 {
|
||||
t.Errorf("got %d instead of %d as protocol option", o.Protocol, 3)
|
||||
}
|
||||
|
||||
for set, want := range testCasesMap {
|
||||
o := &Options{Protocol: set}
|
||||
o.init()
|
||||
if o.Protocol != want {
|
||||
t.Errorf("got %d instead of %d as protocol option", o.Protocol, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user