summaryrefslogtreecommitdiffhomepage
path: root/modules/collect_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2019-07-31 08:21:17 +0200
committerBjørn Erik Pedersen <[email protected]>2019-07-31 12:10:05 +0200
commit4b6c5eba306e6e69f3dd07a6c102bfc8040b38c9 (patch)
treecf12d586dc4fc0937900b96b81e10a852eeeba6f /modules/collect_test.go
parentedf9f0a354e5eaa556f8faed70b5243b7273b35c (diff)
downloadhugo-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.go16
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)
+
+}