(t *testing.T)
| 370 | } |
| 371 | |
| 372 | func TestValues_EmbeddedStructs(t *testing.T) { |
| 373 | type Inner struct { |
| 374 | V string |
| 375 | } |
| 376 | type Outer struct { |
| 377 | Inner |
| 378 | } |
| 379 | type OuterPtr struct { |
| 380 | *Inner |
| 381 | } |
| 382 | type Mixed struct { |
| 383 | Inner |
| 384 | V string |
| 385 | } |
| 386 | type unexported struct { |
| 387 | Inner |
| 388 | V string |
| 389 | } |
| 390 | type Exported struct { |
| 391 | unexported |
| 392 | } |
| 393 | |
| 394 | tests := []struct { |
| 395 | input interface{} |
| 396 | want url.Values |
| 397 | }{ |
| 398 | { |
| 399 | Outer{Inner{V: "a"}}, |
| 400 | url.Values{"V": {"a"}}, |
| 401 | }, |
| 402 | { |
| 403 | OuterPtr{&Inner{V: "a"}}, |
| 404 | url.Values{"V": {"a"}}, |
| 405 | }, |
| 406 | { |
| 407 | Mixed{Inner: Inner{V: "a"}, V: "b"}, |
| 408 | url.Values{"V": {"b", "a"}}, |
| 409 | }, |
| 410 | { |
| 411 | // values from unexported embed are still included |
| 412 | Exported{ |
| 413 | unexported{ |
| 414 | Inner: Inner{V: "bar"}, |
| 415 | V: "foo", |
| 416 | }, |
| 417 | }, |
| 418 | url.Values{"V": {"foo", "bar"}}, |
| 419 | }, |
| 420 | } |
| 421 | |
| 422 | for _, tt := range tests { |
| 423 | testValue(t, tt.input, tt.want) |
| 424 | } |
| 425 | } |
| 426 | |
| 427 | func TestValues_InvalidInput(t *testing.T) { |
| 428 | _, err := Values("") |
nothing calls this directly
no test coverage detected
searching dependent graphs…