@@ -71,16 +71,14 @@ func TestPatchCommentsMessage(t *testing.T) {
7171 Documentation : Input ,
7272 }
7373 model := NewTestAPI ([]* Message {m0 }, []* Enum {}, []* Service {})
74- cfg := config.Config {
75- CommentOverrides : []config.DocumentationOverride {
76- {
77- ID : ".test.Message0" ,
78- Match : Match ,
79- Replace : Replace ,
80- },
74+ overrides := []config.DocumentationOverride {
75+ {
76+ ID : ".test.Message0" ,
77+ Match : Match ,
78+ Replace : Replace ,
8179 },
8280 }
83- if err := PatchDocumentation (model , & cfg ); err != nil {
81+ if err := PatchDocumentation (model , overrides ); err != nil {
8482 t .Fatal (err )
8583 }
8684
@@ -143,16 +141,14 @@ func TestPatchCommentsMessageNotFound(t *testing.T) {
143141 "NotAThing" ,
144142 }
145143 for _ , id := range missing {
146- cfg := config.Config {
147- CommentOverrides : []config.DocumentationOverride {
148- {
149- ID : id ,
150- Match : Match ,
151- Replace : Replace ,
152- },
144+ overrides := []config.DocumentationOverride {
145+ {
146+ ID : id ,
147+ Match : Match ,
148+ Replace : Replace ,
153149 },
154150 }
155- if err := PatchDocumentation (model , & cfg ); err == nil {
151+ if err := PatchDocumentation (model , overrides ); err == nil {
156152 t .Errorf ("expected an error searching for missing entity %q" , id )
157153 }
158154 }
@@ -170,16 +166,14 @@ func TestPatchCommentsNoMatch(t *testing.T) {
170166 ".test.Service0.Method0" ,
171167 }
172168 for _ , id := range missing {
173- cfg := config.Config {
174- CommentOverrides : []config.DocumentationOverride {
175- {
176- ID : id ,
177- Match : "NOT A STRING WE WILL FIND" ,
178- Replace : Replace ,
179- },
169+ overrides := []config.DocumentationOverride {
170+ {
171+ ID : id ,
172+ Match : "NOT A STRING WE WILL FIND" ,
173+ Replace : Replace ,
180174 },
181175 }
182- if err := PatchDocumentation (model , & cfg ); err == nil {
176+ if err := PatchDocumentation (model , overrides ); err == nil {
183177 t .Errorf ("expected an error replacing comments for entity %q" , id )
184178 }
185179 }
@@ -198,16 +192,14 @@ func TestPatchCommentsField(t *testing.T) {
198192 Fields : []* Field {f0 },
199193 }
200194 model := NewTestAPI ([]* Message {m0 }, []* Enum {}, []* Service {})
201- cfg := config.Config {
202- CommentOverrides : []config.DocumentationOverride {
203- {
204- ID : ".test.Message0.field_name" ,
205- Match : Match ,
206- Replace : Replace ,
207- },
195+ overrides := []config.DocumentationOverride {
196+ {
197+ ID : ".test.Message0.field_name" ,
198+ Match : Match ,
199+ Replace : Replace ,
208200 },
209201 }
210- if err := PatchDocumentation (model , & cfg ); err != nil {
202+ if err := PatchDocumentation (model , overrides ); err != nil {
211203 t .Fatal (err )
212204 }
213205
@@ -224,16 +216,14 @@ func TestPatchCommentsEnum(t *testing.T) {
224216 Documentation : Input ,
225217 }
226218 model := NewTestAPI ([]* Message {}, []* Enum {e0 }, []* Service {})
227- cfg := config.Config {
228- CommentOverrides : []config.DocumentationOverride {
229- {
230- ID : ".test.Enum0" ,
231- Match : Match ,
232- Replace : Replace ,
233- },
219+ overrides := []config.DocumentationOverride {
220+ {
221+ ID : ".test.Enum0" ,
222+ Match : Match ,
223+ Replace : Replace ,
234224 },
235225 }
236- if err := PatchDocumentation (model , & cfg ); err != nil {
226+ if err := PatchDocumentation (model , overrides ); err != nil {
237227 t .Fatal (err )
238228 }
239229
@@ -256,16 +246,14 @@ func TestPatchCommentsEnumValue(t *testing.T) {
256246 Documentation : Input ,
257247 }
258248 model := NewTestAPI ([]* Message {}, []* Enum {e0 }, []* Service {})
259- cfg := config.Config {
260- CommentOverrides : []config.DocumentationOverride {
261- {
262- ID : ".test.Enum0.ENUM_VALUE" ,
263- Match : Match ,
264- Replace : Replace ,
265- },
249+ overrides := []config.DocumentationOverride {
250+ {
251+ ID : ".test.Enum0.ENUM_VALUE" ,
252+ Match : Match ,
253+ Replace : Replace ,
266254 },
267255 }
268- if err := PatchDocumentation (model , & cfg ); err != nil {
256+ if err := PatchDocumentation (model , overrides ); err != nil {
269257 t .Fatal (err )
270258 }
271259
@@ -282,16 +270,14 @@ func TestPatchCommentsService(t *testing.T) {
282270 Documentation : Input ,
283271 }
284272 model := NewTestAPI ([]* Message {}, []* Enum {}, []* Service {s0 })
285- cfg := config.Config {
286- CommentOverrides : []config.DocumentationOverride {
287- {
288- ID : ".test.Service0" ,
289- Match : Match ,
290- Replace : Replace ,
291- },
273+ overrides := []config.DocumentationOverride {
274+ {
275+ ID : ".test.Service0" ,
276+ Match : Match ,
277+ Replace : Replace ,
292278 },
293279 }
294- if err := PatchDocumentation (model , & cfg ); err != nil {
280+ if err := PatchDocumentation (model , overrides ); err != nil {
295281 t .Fatal (err )
296282 }
297283
@@ -313,16 +299,14 @@ func TestPatchCommentsMethod(t *testing.T) {
313299 Methods : []* Method {m0 },
314300 }
315301 model := NewTestAPI ([]* Message {}, []* Enum {}, []* Service {s0 })
316- cfg := config.Config {
317- CommentOverrides : []config.DocumentationOverride {
318- {
319- ID : ".test.Service0.Method" ,
320- Match : Match ,
321- Replace : Replace ,
322- },
302+ overrides := []config.DocumentationOverride {
303+ {
304+ ID : ".test.Service0.Method" ,
305+ Match : Match ,
306+ Replace : Replace ,
323307 },
324308 }
325- if err := PatchDocumentation (model , & cfg ); err != nil {
309+ if err := PatchDocumentation (model , overrides ); err != nil {
326310 t .Fatal (err )
327311 }
328312
0 commit comments