aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib/page_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'hugolib/page_test.go')
-rw-r--r--hugolib/page_test.go36
1 files changed, 21 insertions, 15 deletions
diff --git a/hugolib/page_test.go b/hugolib/page_test.go
index fd115385d..ecaf1dc5c 100644
--- a/hugolib/page_test.go
+++ b/hugolib/page_test.go
@@ -642,27 +642,33 @@ Simple Page With Some Date`
testAllMarkdownEnginesForPages(t, assertFunc, nil, pageContents...)
}
-// Issue #2601
func TestPageRawContent(t *testing.T) {
- t.Parallel()
- c := qt.New(t)
- cfg, fs := newTestCfg()
- configs, err := loadTestConfigFromProvider(cfg)
- c.Assert(err, qt.IsNil)
- writeSource(t, fs, filepath.Join("content", "raw.md"), `---
-title: Raw
+ files := `
+-- hugo.toml --
+-- content/basic.md --
---
-**Raw**`)
-
- writeSource(t, fs, filepath.Join("layouts", "_default", "single.html"), `{{ .RawContent }}`)
+title: "basic"
+---
+**basic**
+-- content/empty.md --
+---
+title: "empty"
+---
+-- layouts/_default/single.html --
+|{{ .RawContent }}|
+`
- s := buildSingleSite(t, deps.DepsCfg{Fs: fs, Configs: configs}, BuildCfg{SkipRender: true})
+ b := NewIntegrationTestBuilder(
+ IntegrationTestConfig{
+ T: t,
+ TxtarString: files,
+ },
+ ).Build()
- c.Assert(len(s.RegularPages()), qt.Equals, 1)
- p := s.RegularPages()[0]
+ b.AssertFileContent("public/basic/index.html", "|**basic**|")
+ b.AssertFileContent("public/empty/index.html", "! title")
- c.Assert("**Raw**", qt.Equals, p.RawContent())
}
func TestPageWithShortCodeInSummary(t *testing.T) {