@@ -12,7 +12,11 @@ import (
12
12
"testing"
13
13
)
14
14
15
- // go test -v -run ^TestCtx_GetReqHeadersAll
15
+ // TestCtx_GetReqHeadersAll ensures GetReqHeadersAll returns all request headers.
16
+ //
17
+ // To run:
18
+ //
19
+ // go test -v -run ^TestCtx_GetReqHeadersAll$
16
20
func TestCtx_GetReqHeadersAll (t * testing.T ) {
17
21
ctx := & Ctx {
18
22
Headers : map [string ][]string {
@@ -32,7 +36,11 @@ func TestCtx_GetReqHeadersAll(t *testing.T) {
32
36
}
33
37
}
34
38
35
- // go test -v -run ^TestCtx_GetHeadersAll
39
+ // TestCtx_GetHeadersAll ensures GetHeadersAll returns all headers from the context.
40
+ //
41
+ // To run:
42
+ //
43
+ // go test -v -run ^TestCtx_GetHeadersAll$
36
44
func TestCtx_GetHeadersAll (t * testing.T ) {
37
45
ctx := & Ctx {
38
46
Headers : map [string ][]string {
@@ -52,7 +60,11 @@ func TestCtx_GetHeadersAll(t *testing.T) {
52
60
}
53
61
}
54
62
55
- // go test -v -run ^TestCtx_ExampleBind
63
+ // TestCtx_ExampleBind verifies that Bind correctly binds JSON body to a struct.
64
+ //
65
+ // To run:
66
+ //
67
+ // go test -v -run ^TestCtx_ExampleBind$
56
68
func TestCtx_ExampleBind (t * testing.T ) {
57
69
q := New ()
58
70
@@ -90,7 +102,11 @@ func TestCtx_ExampleBind(t *testing.T) {
90
102
}
91
103
}
92
104
93
- // go test -v -run ^TestCtx_ExampleBodyParser
105
+ // TestCtx_ExampleBodyParser checks if BodyParser parses the request body into a struct.
106
+ //
107
+ // To run:
108
+ //
109
+ // go test -v -run ^TestCtx_ExampleBodyParser$
94
110
func TestCtx_ExampleBodyParser (t * testing.T ) {
95
111
q := New ()
96
112
@@ -126,7 +142,11 @@ func TestCtx_ExampleBodyParser(t *testing.T) {
126
142
}
127
143
}
128
144
129
- // go test -v -run ^TestCtx_ExampleParam
145
+ // TestCtx_ExampleParam checks if Param correctly retrieves path parameters.
146
+ //
147
+ // To run:
148
+ //
149
+ // go test -v -run ^TestCtx_ExampleParam$
130
150
func TestCtx_ExampleParam (t * testing.T ) {
131
151
q := New ()
132
152
@@ -146,7 +166,11 @@ func TestCtx_ExampleParam(t *testing.T) {
146
166
}
147
167
}
148
168
149
- // go test -v -run ^TestCtx_ExampleBody
169
+ // TestCtx_ExampleBody ensures Body returns the correct raw request body.
170
+ //
171
+ // To run:
172
+ //
173
+ // go test -v -run ^TestCtx_ExampleBody$
150
174
func TestCtx_ExampleBody (t * testing.T ) {
151
175
expectedBody := `{"name": "Quick", "age": 28}`
152
176
@@ -161,7 +185,11 @@ func TestCtx_ExampleBody(t *testing.T) {
161
185
}
162
186
}
163
187
164
- // go test -v -run ^TestCtx_ExampleBodyString
188
+ // TestCtx_ExampleBodyString ensures BodyString returns the body as a string.
189
+ //
190
+ // To run:
191
+ //
192
+ // go test -v -run ^TestCtx_ExampleBodyString$
165
193
func TestCtx_ExampleBodyString (t * testing.T ) {
166
194
expectedBody := `{"name": "Quick", "age": 28}`
167
195
@@ -176,7 +204,11 @@ func TestCtx_ExampleBodyString(t *testing.T) {
176
204
}
177
205
}
178
206
179
- // go test -v -run ^TestCtx_ExampleJSON
207
+ // TestCtx_ExampleJSON validates JSON response generation.
208
+ //
209
+ // To run:
210
+ //
211
+ // go test -v -run ^TestCtx_ExampleJSON$
180
212
func TestCtx_ExampleJSON (t * testing.T ) {
181
213
q := New ()
182
214
@@ -205,7 +237,11 @@ func TestCtx_ExampleJSON(t *testing.T) {
205
237
}
206
238
}
207
239
208
- // go test -v -run ^TestCtx_ExampleJSONIN
240
+ // TestCtx_ExampleJSONIN ensures JSONIN returns correct JSON with header set.
241
+ //
242
+ // To run:
243
+ //
244
+ // go test -v -run ^TestCtx_ExampleJSONIN$
209
245
func TestCtx_ExampleJSONIN (t * testing.T ) {
210
246
q := New ()
211
247
@@ -238,7 +274,11 @@ type XMLMessage struct {
238
274
Message string `xml:",chardata"`
239
275
}
240
276
241
- // go test -v -run ^TestCtx_ExampleXML
277
+ // TestCtx_ExampleXML verifies that XML responses are returned properly.
278
+ //
279
+ // To run:
280
+ //
281
+ // go test -v -run ^TestCtx_ExampleXML$
242
282
func TestCtx_ExampleXML (t * testing.T ) {
243
283
q := New ()
244
284
@@ -267,7 +307,11 @@ func TestCtx_ExampleXML(t *testing.T) {
267
307
}
268
308
}
269
309
270
- // go test -v -run ^TestCtx_ExamplewriteResponse
310
+ // TestCtx_ExamplewriteResponse validates raw byte response writing.
311
+ //
312
+ // To run:
313
+ //
314
+ // go test -v -run ^TestCtx_ExamplewriteResponse$
271
315
func TestCtx_ExamplewriteResponse (t * testing.T ) {
272
316
q := New ()
273
317
@@ -292,7 +336,11 @@ func TestCtx_ExamplewriteResponse(t *testing.T) {
292
336
}
293
337
}
294
338
295
- // go test -v -run ^TestCtx_ExampleByte
339
+ // TestCtx_ExampleByte checks that Byte correctly writes raw bytes.
340
+ //
341
+ // To run:
342
+ //
343
+ // go test -v -run ^TestCtx_ExampleByte$
296
344
func TestCtx_ExampleByte (t * testing.T ) {
297
345
q := New ()
298
346
@@ -317,7 +365,11 @@ func TestCtx_ExampleByte(t *testing.T) {
317
365
}
318
366
}
319
367
320
- // go test -v -run ^TestCtx_ExampleSend
368
+ // TestCtx_ExampleSend validates that Send writes the correct byte response.
369
+ //
370
+ // To run:
371
+ //
372
+ // go test -v -run ^TestCtx_ExampleSend$
321
373
func TestCtx_ExampleSend (t * testing.T ) {
322
374
q := New ()
323
375
@@ -342,7 +394,11 @@ func TestCtx_ExampleSend(t *testing.T) {
342
394
}
343
395
}
344
396
345
- // go test -v -run ^TestCtx_ExampleSendString
397
+ // TestCtx_ExampleSendString checks that SendString writes a plain text response.
398
+ //
399
+ // To run:
400
+ //
401
+ // go test -v -run ^TestCtx_ExampleSendString$
346
402
func TestCtx_ExampleSendString (t * testing.T ) {
347
403
q := New ()
348
404
@@ -367,7 +423,11 @@ func TestCtx_ExampleSendString(t *testing.T) {
367
423
}
368
424
}
369
425
370
- // go test -v -run ^TestCtx_ExampleSendFile
426
+ // TestCtx_ExampleSendFile ensures that SendFile correctly sends file content.
427
+ //
428
+ // To run:
429
+ //
430
+ // go test -v -run ^TestCtx_ExampleSendFile$
371
431
func TestCtx_ExampleSendFile (t * testing.T ) {
372
432
q := New ()
373
433
@@ -393,7 +453,11 @@ func TestCtx_ExampleSendFile(t *testing.T) {
393
453
}
394
454
}
395
455
396
- // go test -v -run ^TestCtx_ExampleSet
456
+ // TestCtx_ExampleSet verifies that Set adds headers correctly.
457
+ //
458
+ // To run:
459
+ //
460
+ // go test -v -run ^TestCtx_ExampleSet$
397
461
func TestCtx_ExampleSet (t * testing.T ) {
398
462
q := New ()
399
463
@@ -420,7 +484,11 @@ func TestCtx_ExampleSet(t *testing.T) {
420
484
}
421
485
}
422
486
423
- // go test -v -run ^TestCtx_ExampleAppend
487
+ // TestCtx_ExampleAppend ensures that headers can be appended properly.
488
+ //
489
+ // To run:
490
+ //
491
+ // go test -v -run ^TestCtx_ExampleAppend$
424
492
func TestCtx_ExampleAppend (t * testing.T ) {
425
493
q := New ()
426
494
@@ -443,7 +511,11 @@ func TestCtx_ExampleAppend(t *testing.T) {
443
511
}
444
512
}
445
513
446
- // go test -v -run ^TestCtx_ExampleAccepts
514
+ // TestCtx_ExampleAccepts checks if the Accepts method sets the correct header.
515
+ //
516
+ // To run:
517
+ //
518
+ // go test -v -run ^TestCtx_ExampleAccepts$
447
519
func TestCtx_ExampleAccepts (t * testing.T ) {
448
520
q := New ()
449
521
@@ -465,7 +537,11 @@ func TestCtx_ExampleAccepts(t *testing.T) {
465
537
}
466
538
}
467
539
468
- // go test -v -run ^TestCtx_ExampleStatus
540
+ // TestCtx_ExampleStatus verifies that Status sets the correct HTTP status code.
541
+ //
542
+ // To run:
543
+ //
544
+ // go test -v -run ^TestCtx_ExampleStatus$
469
545
func TestCtx_ExampleStatus (t * testing.T ) {
470
546
q := New ()
471
547
0 commit comments