diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2019-08-15 16:44:44 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2019-08-15 19:14:22 +0200 |
commit | 952a3194962dd91f87e5bd227a1591b00c39ff05 (patch) | |
tree | b5c20ff0fea1b92190e21dbd6742ccf3a8d808d4 /hugolib/filesystems/basefs_test.go | |
parent | 321418f22a4a94b87f01e1403a2f4a71106461fb (diff) |
Fix live reload mount logic with sub paths
Fixes #6209
Diffstat (limited to 'hugolib/filesystems/basefs_test.go')
-rw-r--r-- | hugolib/filesystems/basefs_test.go | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/hugolib/filesystems/basefs_test.go b/hugolib/filesystems/basefs_test.go index 47aef63ce..3cac4f11a 100644 --- a/hugolib/filesystems/basefs_test.go +++ b/hugolib/filesystems/basefs_test.go @@ -360,14 +360,19 @@ func TestMakePathRelative(t *testing.T) { workDir := "mywork" v.Set("workingDir", workDir) - c.Assert(fs.Source.MkdirAll(filepath.Join(workDir, "dist"), 0777), qt.IsNil) - c.Assert(fs.Source.MkdirAll(filepath.Join(workDir, "static"), 0777), qt.IsNil) + c.Assert(fs.Source.MkdirAll(filepath.Join(workDir, "dist", "d1"), 0777), qt.IsNil) + c.Assert(fs.Source.MkdirAll(filepath.Join(workDir, "static", "d2"), 0777), qt.IsNil) + c.Assert(fs.Source.MkdirAll(filepath.Join(workDir, "dust", "d2"), 0777), qt.IsNil) moduleCfg := map[string]interface{}{ "mounts": []interface{}{ map[string]interface{}{ "source": "dist", - "target": "static/dist", + "target": "static/mydist", + }, + map[string]interface{}{ + "source": "dust", + "target": "static/foo/bar", }, map[string]interface{}{ "source": "static", @@ -388,8 +393,10 @@ func TestMakePathRelative(t *testing.T) { sfs := bfs.Static[""] c.Assert(sfs, qt.Not(qt.IsNil)) - c.Assert(sfs.MakePathRelative(filepath.Join(workDir, "static", "foo.txt")), qt.Equals, filepath.FromSlash("/foo.txt")) - c.Assert(sfs.MakePathRelative(filepath.Join(workDir, "dist", "foo.txt")), qt.Equals, filepath.FromSlash("/dist/foo.txt")) + c.Assert(sfs.MakePathRelative(filepath.Join(workDir, "dist", "d1", "foo.txt")), qt.Equals, filepath.FromSlash("mydist/d1/foo.txt")) + c.Assert(sfs.MakePathRelative(filepath.Join(workDir, "static", "d2", "foo.txt")), qt.Equals, filepath.FromSlash("d2/foo.txt")) + c.Assert(sfs.MakePathRelative(filepath.Join(workDir, "dust", "d3", "foo.txt")), qt.Equals, filepath.FromSlash("foo/bar/d3/foo.txt")) + } func checkFileCount(fs afero.Fs, dirname string, c *qt.C, expected int) { |