summaryrefslogtreecommitdiffstats
path: root/hugolib/page_permalink_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'hugolib/page_permalink_test.go')
-rw-r--r--hugolib/page_permalink_test.go35
1 files changed, 22 insertions, 13 deletions
diff --git a/hugolib/page_permalink_test.go b/hugolib/page_permalink_test.go
index 7ea672330..bc89638d3 100644
--- a/hugolib/page_permalink_test.go
+++ b/hugolib/page_permalink_test.go
@@ -16,12 +16,11 @@ package hugolib
import (
"fmt"
"html/template"
- "path/filepath"
"testing"
qt "github.com/frankban/quicktest"
- "github.com/gohugoio/hugo/deps"
+ "github.com/gohugoio/hugo/config"
)
func TestPermalink(t *testing.T) {
@@ -68,28 +67,38 @@ func TestPermalink(t *testing.T) {
t.Run(fmt.Sprintf("%s-%d", test.file, i), func(t *testing.T) {
t.Parallel()
c := qt.New(t)
- cfg, fs := newTestCfg()
-
+ cfg := config.New()
cfg.Set("uglyURLs", test.uglyURLs)
cfg.Set("canonifyURLs", test.canonifyURLs)
- cfg.Set("baseURL", test.base)
- pageContent := fmt.Sprintf(`---
+ files := fmt.Sprintf(`
+-- hugo.toml --
+baseURL = %q
+-- content/%s --
+---
title: Page
slug: %q
-url: %q
+url: %q
output: ["HTML"]
---
-Content
-`, test.slug, test.url)
+`, test.base, test.file, test.slug, test.url)
- writeSource(t, fs, filepath.Join("content", filepath.FromSlash(test.file)), pageContent)
+ if i > 0 {
+ t.Skip()
+ }
- s := buildSingleSite(t, deps.DepsCfg{Fs: fs, Cfg: cfg}, BuildCfg{SkipRender: true})
- c.Assert(len(s.RegularPages()), qt.Equals, 1)
+ b := NewIntegrationTestBuilder(
+ IntegrationTestConfig{
+ T: t,
+ TxtarString: files,
+ BaseCfg: cfg,
+ },
+ )
+ b.Build()
+ s := b.H.Sites[0]
+ c.Assert(len(s.RegularPages()), qt.Equals, 1)
p := s.RegularPages()[0]
-
u := p.Permalink()
expected := test.expectedAbs