(c *C)
| 16 | } |
| 17 | |
| 18 | func (s *ModulesSuite) TestValidateBadPath(c *C) { |
| 19 | input := []string{ |
| 20 | `..`, |
| 21 | `../`, |
| 22 | `../bar`, |
| 23 | |
| 24 | `/..`, |
| 25 | `/../bar`, |
| 26 | |
| 27 | `foo/..`, |
| 28 | `foo/../`, |
| 29 | `foo/../bar`, |
| 30 | } |
| 31 | |
| 32 | for _, p := range input { |
| 33 | m := &Submodule{ |
| 34 | Name: "ok", |
| 35 | Path: p, |
| 36 | URL: "https://example.com/", |
| 37 | } |
| 38 | c.Assert(m.Validate(), Equals, ErrModuleBadPath) |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | func (s *ModulesSuite) TestValidateMissingName(c *C) { |
| 43 | m := &Submodule{Name: "ok", URL: "bar"} |