(t *testing.T)
| 330 | } |
| 331 | |
| 332 | func TestValues_OmitEmpty(t *testing.T) { |
| 333 | str := "" |
| 334 | |
| 335 | tests := []struct { |
| 336 | input interface{} |
| 337 | want url.Values |
| 338 | }{ |
| 339 | {struct{ v string }{}, url.Values{}}, // non-exported field |
| 340 | { |
| 341 | struct { |
| 342 | V string `url:",omitempty"` |
| 343 | }{}, |
| 344 | url.Values{}, |
| 345 | }, |
| 346 | { |
| 347 | struct { |
| 348 | V string `url:"-"` |
| 349 | }{}, |
| 350 | url.Values{}, |
| 351 | }, |
| 352 | { |
| 353 | struct { |
| 354 | V string `url:"omitempty"` // actually named omitempty |
| 355 | }{}, |
| 356 | url.Values{"omitempty": {""}}, |
| 357 | }, |
| 358 | { |
| 359 | // include value for a non-nil pointer to an empty value |
| 360 | struct { |
| 361 | V *string `url:",omitempty"` |
| 362 | }{&str}, |
| 363 | url.Values{"V": {""}}, |
| 364 | }, |
| 365 | } |
| 366 | |
| 367 | for _, tt := range tests { |
| 368 | testValue(t, tt.input, tt.want) |
| 369 | } |
| 370 | } |
| 371 | |
| 372 | func TestValues_EmbeddedStructs(t *testing.T) { |
| 373 | type Inner struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…