(t *testing.T)
| 548 | } |
| 549 | |
| 550 | func TestContext_PathValues(t *testing.T) { |
| 551 | var testCases = []struct { |
| 552 | name string |
| 553 | given PathValues |
| 554 | expect PathValues |
| 555 | }{ |
| 556 | { |
| 557 | name: "param exists", |
| 558 | given: PathValues{ |
| 559 | {Name: "uid", Value: "101"}, |
| 560 | {Name: "fid", Value: "501"}, |
| 561 | }, |
| 562 | expect: PathValues{ |
| 563 | {Name: "uid", Value: "101"}, |
| 564 | {Name: "fid", Value: "501"}, |
| 565 | }, |
| 566 | }, |
| 567 | { |
| 568 | name: "params is empty", |
| 569 | given: PathValues{}, |
| 570 | expect: PathValues{}, |
| 571 | }, |
| 572 | } |
| 573 | |
| 574 | for _, tc := range testCases { |
| 575 | t.Run(tc.name, func(t *testing.T) { |
| 576 | e := New() |
| 577 | req := httptest.NewRequest(http.MethodGet, "/", nil) |
| 578 | c := e.NewContext(req, nil) |
| 579 | |
| 580 | c.SetPathValues(tc.given) |
| 581 | |
| 582 | assert.EqualValues(t, tc.expect, c.PathValues()) |
| 583 | }) |
| 584 | } |
| 585 | } |
| 586 | |
| 587 | func TestContext_PathParam(t *testing.T) { |
| 588 | var testCases = []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…