mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
modules: Adjust watch logic vs workspace use definitions
This commit is contained in:
@@ -14,6 +14,9 @@
|
||||
package modules
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/gohugoio/hugo/common/hugo"
|
||||
@@ -43,8 +46,9 @@ func TestDecodeConfig(t *testing.T) {
|
||||
c := qt.New(t)
|
||||
|
||||
c.Run("Basic", func(c *qt.C) {
|
||||
tempDir := c.TempDir()
|
||||
tomlConfig := `
|
||||
workingDir = "/src/project"
|
||||
workingDir = %q
|
||||
[module]
|
||||
workspace = "hugo.work"
|
||||
[module.hugoVersion]
|
||||
@@ -65,7 +69,11 @@ source="src/markdown/blog"
|
||||
target="content/blog"
|
||||
lang="en"
|
||||
`
|
||||
cfg, err := config.FromConfigString(tomlConfig, "toml")
|
||||
|
||||
hugoWorkFilename := filepath.Join(tempDir, "hugo.work")
|
||||
f, _ := os.Create(hugoWorkFilename)
|
||||
f.Close()
|
||||
cfg, err := config.FromConfigString(fmt.Sprintf(tomlConfig, tempDir), "toml")
|
||||
c.Assert(err, qt.IsNil)
|
||||
|
||||
mcfg, err := DecodeConfig(cfg)
|
||||
@@ -83,7 +91,7 @@ lang="en"
|
||||
c.Assert(hv.IsValid(), qt.Equals, true)
|
||||
}
|
||||
|
||||
c.Assert(mcfg.Workspace, qt.Equals, "/src/project/hugo.work")
|
||||
c.Assert(mcfg.Workspace, qt.Equals, hugoWorkFilename)
|
||||
|
||||
c.Assert(len(mcfg.Mounts), qt.Equals, 1)
|
||||
c.Assert(len(mcfg.Imports), qt.Equals, 1)
|
||||
|
Reference in New Issue
Block a user