(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func TestCoversPath(t *testing.T) { |
| 10 | tests := []struct { |
| 11 | name string |
| 12 | metaPath string |
| 13 | reqPath string |
| 14 | applySub bool |
| 15 | want bool |
| 16 | }{ |
| 17 | { |
| 18 | name: "exact path match with applySub=false", |
| 19 | metaPath: "/folder", |
| 20 | reqPath: "/folder", |
| 21 | applySub: false, |
| 22 | want: true, |
| 23 | }, |
| 24 | { |
| 25 | name: "exact path match with applySub=true", |
| 26 | metaPath: "/folder", |
| 27 | reqPath: "/folder", |
| 28 | applySub: true, |
| 29 | want: true, |
| 30 | }, |
| 31 | { |
| 32 | name: "sub path with applySub=true", |
| 33 | metaPath: "/folder", |
| 34 | reqPath: "/folder/subfolder", |
| 35 | applySub: true, |
| 36 | want: true, |
| 37 | }, |
| 38 | { |
| 39 | name: "sub path with applySub=false", |
| 40 | metaPath: "/folder", |
| 41 | reqPath: "/folder/subfolder", |
| 42 | applySub: false, |
| 43 | want: false, |
| 44 | }, |
| 45 | { |
| 46 | name: "non-sub path with applySub=true", |
| 47 | metaPath: "/folder", |
| 48 | reqPath: "/other", |
| 49 | applySub: true, |
| 50 | want: false, |
| 51 | }, |
| 52 | { |
| 53 | name: "non-sub path with applySub=false", |
| 54 | metaPath: "/folder", |
| 55 | reqPath: "/other", |
| 56 | applySub: false, |
| 57 | want: false, |
| 58 | }, |
| 59 | { |
| 60 | name: "root path covers all with applySub=true", |
| 61 | metaPath: "/", |
| 62 | reqPath: "/any/deep/path", |
| 63 | applySub: true, |
| 64 | want: true, |
| 65 | }, |
| 66 | { |
nothing calls this directly
no test coverage detected