MCPcopy Index your code
hub / github.com/coder/coder / TestRPCVersionListParseString

Function TestRPCVersionListParseString

vpn/version_test.go:121–190  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

119}
120
121func TestRPCVersionListParseString(t *testing.T) {
122 t.Parallel()
123
124 cases := []struct {
125 name string
126 input string
127 want vpn.RPCVersionList
128 errContains string
129 }{
130 {
131 name: "single version",
132 input: "1.0",
133 want: vpn.RPCVersionList{
134 Versions: []vpn.RPCVersion{
135 {Major: 1, Minor: 0},
136 },
137 },
138 },
139 {
140 name: "multiple versions",
141 input: "1.1,2.3,3.2",
142 want: vpn.RPCVersionList{
143 Versions: []vpn.RPCVersion{
144 {Major: 1, Minor: 1},
145 {Major: 2, Minor: 3},
146 {Major: 3, Minor: 2},
147 },
148 },
149 },
150 {
151 name: "invalid version",
152 input: "1.0,invalid",
153 errContains: "invalid version list",
154 },
155 {
156 name: "empty string",
157 input: "",
158 errContains: "invalid version list",
159 },
160 {
161 name: "duplicate versions",
162 input: "1.0,1.0",
163 errContains: "duplicate major version",
164 },
165 {
166 name: "duplicate major versions",
167 input: "1.0,1.2",
168 errContains: "duplicate major version",
169 },
170 {
171 name: "out of order versions",
172 input: "2.0,1.0",
173 errContains: "versions are not sorted",
174 },
175 }
176
177 for _, tc := range cases {
178 t.Run(tc.name, func(t *testing.T) {

Callers

nothing calls this directly

Calls 4

ParseRPCVersionListFunction · 0.92
RunMethod · 0.65
EqualMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected