mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-27 22:21:07 +03:00
Move the mount duplicate filter to the modules package
Also simplify the mount validation logic. There are plenty of ways a user can create mount configs that behaves oddly.
This commit is contained in:
parent
edf9f0a354
commit
4b6c5eba30
6 changed files with 154 additions and 123 deletions
|
@ -36,3 +36,19 @@ func TestPathKey(t *testing.T) {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
func TestFilterUnwantedMounts(t *testing.T) {
|
||||
|
||||
mounts := []Mount{
|
||||
Mount{Source: "a", Target: "b", Lang: "en"},
|
||||
Mount{Source: "a", Target: "b", Lang: "en"},
|
||||
Mount{Source: "b", Target: "c", Lang: "en"},
|
||||
}
|
||||
|
||||
filtered := filterUnwantedMounts(mounts)
|
||||
|
||||
assert := require.New(t)
|
||||
assert.Len(filtered, 2)
|
||||
assert.Equal([]Mount{Mount{Source: "a", Target: "b", Lang: "en"}, Mount{Source: "b", Target: "c", Lang: "en"}}, filtered)
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue