mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-13 20:24:00 +02: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:
@@ -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)
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user