forked from tarantool/go-tarantool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
protocol_test.go
37 lines (28 loc) · 1.02 KB
/
protocol_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package tarantool_test
import (
"testing"
"github.com/stretchr/testify/require"
. "github.com/tarantool/go-tarantool"
)
func TestProtocolInfoClonePreservesFeatures(t *testing.T) {
original := ProtocolInfo{
Version: ProtocolVersion(100),
Features: []ProtocolFeature{ProtocolFeature(99), ProtocolFeature(100)},
}
origCopy := original.Clone()
original.Features[1] = ProtocolFeature(98)
require.Equal(t,
origCopy,
ProtocolInfo{
Version: ProtocolVersion(100),
Features: []ProtocolFeature{ProtocolFeature(99), ProtocolFeature(100)},
})
}
func TestFeatureStringRepresentation(t *testing.T) {
require.Equal(t, StreamsFeature.String(), "StreamsFeature")
require.Equal(t, TransactionsFeature.String(), "TransactionsFeature")
require.Equal(t, ErrorExtensionFeature.String(), "ErrorExtensionFeature")
require.Equal(t, WatchersFeature.String(), "WatchersFeature")
require.Equal(t, PaginationFeature.String(), "PaginationFeature")
require.Equal(t, ProtocolFeature(15532).String(), "Unknown feature (code 15532)")
}