Skip to content

Commit 74e9129

Browse files
committed
hugolib: Add an asciidoc rebuild test case
See #12375
1 parent df11327 commit 74e9129

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

hugolib/rebuild_test.go

+39
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
qt "github.com/frankban/quicktest"
1212
"github.com/gohugoio/hugo/common/types"
1313
"github.com/gohugoio/hugo/htesting"
14+
"github.com/gohugoio/hugo/markup/asciidocext"
1415
"github.com/gohugoio/hugo/resources/resource_transformers/tocss/dartsass"
1516
"github.com/gohugoio/hugo/resources/resource_transformers/tocss/scss"
1617
)
@@ -1514,3 +1515,41 @@ MyTemplate: {{ partial "MyTemplate.html" . }}|
15141515

15151516
b.AssertFileContent("public/index.html", "MyTemplate: MyTemplate Edited")
15161517
}
1518+
1519+
func TestRebuildEditAsciidocContentFile(t *testing.T) {
1520+
if !asciidocext.Supports() {
1521+
t.Skip("skip asciidoc")
1522+
}
1523+
files := `
1524+
-- hugo.toml --
1525+
baseURL = "https://example.com"
1526+
disableLiveReload = true
1527+
disableKinds = ["taxonomy", "term", "sitemap", "robotsTXT", "404", "rss", "home", "section"]
1528+
[security]
1529+
[security.exec]
1530+
allow = ['^python$', '^rst2html.*', '^asciidoctor$']
1531+
-- content/posts/p1.adoc --
1532+
---
1533+
title: "P1"
1534+
---
1535+
P1 Content.
1536+
-- content/posts/p2.adoc --
1537+
---
1538+
title: "P2"
1539+
---
1540+
P2 Content.
1541+
-- layouts/_default/single.html --
1542+
Single: {{ .Title }}|{{ .Content }}|
1543+
`
1544+
b := TestRunning(t, files)
1545+
b.AssertFileContent("public/posts/p1/index.html",
1546+
"Single: P1|<div class=\"paragraph\">\n<p>P1 Content.</p>\n</div>\n|")
1547+
b.AssertRenderCountPage(2)
1548+
b.AssertRenderCountContent(2)
1549+
1550+
b.EditFileReplaceAll("content/posts/p1.adoc", "P1 Content.", "P1 Content Edited.").Build()
1551+
1552+
b.AssertFileContent("public/posts/p1/index.html", "Single: P1|<div class=\"paragraph\">\n<p>P1 Content Edited.</p>\n</div>\n|")
1553+
b.AssertRenderCountPage(1)
1554+
b.AssertRenderCountContent(1)
1555+
}

0 commit comments

Comments
 (0)