diff options
author | Bjørn Erik Pedersen <[email protected]> | 2019-07-31 08:21:17 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2019-07-31 12:10:05 +0200 |
commit | 4b6c5eba306e6e69f3dd07a6c102bfc8040b38c9 (patch) | |
tree | cf12d586dc4fc0937900b96b81e10a852eeeba6f /modules/collect_test.go | |
parent | edf9f0a354e5eaa556f8faed70b5243b7273b35c (diff) | |
download | hugo-4b6c5eba306e6e69f3dd07a6c102bfc8040b38c9.tar.gz hugo-4b6c5eba306e6e69f3dd07a6c102bfc8040b38c9.zip |
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.
Diffstat (limited to 'modules/collect_test.go')
-rw-r--r-- | modules/collect_test.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/modules/collect_test.go b/modules/collect_test.go index d76c0b2bb..63410ddb1 100644 --- a/modules/collect_test.go +++ b/modules/collect_test.go @@ -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) + +} |