diff options
author | Bjørn Erik Pedersen <[email protected]> | 2023-05-20 15:04:22 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2023-05-20 17:45:56 +0200 |
commit | 7c7baa618325cb3d2b1ef48bdc1f97aae25f62e9 (patch) | |
tree | f80cd6e57e2f9dcb07ceae3e7c022f41d4076bfe /resources | |
parent | 4f085e80da9a415725db3def70e5ce847cf06741 (diff) | |
download | hugo-7c7baa618325cb3d2b1ef48bdc1f97aae25f62e9.tar.gz hugo-7c7baa618325cb3d2b1ef48bdc1f97aae25f62e9.zip |
Add hugo.WorkingDir
Fixes #10969
Diffstat (limited to 'resources')
-rw-r--r-- | resources/page/page_matcher_test.go | 17 | ||||
-rw-r--r-- | resources/page/site.go | 4 |
2 files changed, 17 insertions, 4 deletions
diff --git a/resources/page/page_matcher_test.go b/resources/page/page_matcher_test.go index 990312ed1..da47843db 100644 --- a/resources/page/page_matcher_test.go +++ b/resources/page/page_matcher_test.go @@ -25,8 +25,8 @@ import ( func TestPageMatcher(t *testing.T) { c := qt.New(t) - developmentTestSite := testSite{h: hugo.NewInfo("development", nil)} - productionTestSite := testSite{h: hugo.NewInfo("production", nil)} + developmentTestSite := testSite{h: hugo.NewInfo(testConfig{environment: "development"}, nil)} + productionTestSite := testSite{h: hugo.NewInfo(testConfig{environment: "production"}, nil)} p1, p2, p3 := &testPage{path: "/p1", kind: "section", lang: "en", site: developmentTestSite}, @@ -156,3 +156,16 @@ func TestDecodeCascadeConfig(t *testing.T) { c.Assert(got, qt.IsNotNil) } + +type testConfig struct { + environment string + workingDir string +} + +func (c testConfig) Environment() string { + return c.environment +} + +func (c testConfig) WorkingDir() string { + return c.workingDir +} diff --git a/resources/page/site.go b/resources/page/site.go index 16e070160..da97dfe6e 100644 --- a/resources/page/site.go +++ b/resources/page/site.go @@ -444,9 +444,9 @@ func (s testSite) Param(key any) (any, error) { } // NewDummyHugoSite creates a new minimal test site. -func NewDummyHugoSite(cfg config.Provider) Site { +func NewDummyHugoSite(conf config.AllProvider) Site { return testSite{ - h: hugo.NewInfo(hugo.EnvironmentProduction, nil), + h: hugo.NewInfo(conf, nil), l: &langs.Language{ Lang: "en", }, |