| 711 | } |
| 712 | |
| 713 | func TestGroup_StaticPanic(t *testing.T) { |
| 714 | var testCases = []struct { |
| 715 | name string |
| 716 | givenRoot string |
| 717 | }{ |
| 718 | { |
| 719 | name: "panics for ../", |
| 720 | givenRoot: "../images", |
| 721 | }, |
| 722 | { |
| 723 | name: "panics for /", |
| 724 | givenRoot: "/images", |
| 725 | }, |
| 726 | } |
| 727 | |
| 728 | for _, tc := range testCases { |
| 729 | t.Run(tc.name, func(t *testing.T) { |
| 730 | e := New() |
| 731 | e.Filesystem = os.DirFS("./") |
| 732 | |
| 733 | g := e.Group("/assets") |
| 734 | |
| 735 | assert.Panics(t, func() { |
| 736 | g.Static("/images", tc.givenRoot) |
| 737 | }) |
| 738 | }) |
| 739 | } |
| 740 | } |
| 741 | |
| 742 | func TestGroup_RouteNotFoundWithMiddleware(t *testing.T) { |
| 743 | var testCases = []struct { |