From 74e9129568e3b506a34205f11d024400f833a907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 15 Apr 2024 15:48:42 +0200 Subject: [PATCH] hugolib: Add an asciidoc rebuild test case See #12375 --- hugolib/rebuild_test.go | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/hugolib/rebuild_test.go b/hugolib/rebuild_test.go index f2717644d..23e3e0532 100644 --- a/hugolib/rebuild_test.go +++ b/hugolib/rebuild_test.go @@ -11,6 +11,7 @@ import ( qt "github.com/frankban/quicktest" "github.com/gohugoio/hugo/common/types" "github.com/gohugoio/hugo/htesting" + "github.com/gohugoio/hugo/markup/asciidocext" "github.com/gohugoio/hugo/resources/resource_transformers/tocss/dartsass" "github.com/gohugoio/hugo/resources/resource_transformers/tocss/scss" ) @@ -1514,3 +1515,41 @@ MyTemplate: {{ partial "MyTemplate.html" . }}| b.AssertFileContent("public/index.html", "MyTemplate: MyTemplate Edited") } + +func TestRebuildEditAsciidocContentFile(t *testing.T) { + if !asciidocext.Supports() { + t.Skip("skip asciidoc") + } + files := ` +-- hugo.toml -- +baseURL = "https://example.com" +disableLiveReload = true +disableKinds = ["taxonomy", "term", "sitemap", "robotsTXT", "404", "rss", "home", "section"] +[security] +[security.exec] +allow = ['^python$', '^rst2html.*', '^asciidoctor$'] +-- content/posts/p1.adoc -- +--- +title: "P1" +--- +P1 Content. +-- content/posts/p2.adoc -- +--- +title: "P2" +--- +P2 Content. +-- layouts/_default/single.html -- +Single: {{ .Title }}|{{ .Content }}| +` + b := TestRunning(t, files) + b.AssertFileContent("public/posts/p1/index.html", + "Single: P1|
\n

P1 Content.

\n
\n|") + b.AssertRenderCountPage(2) + b.AssertRenderCountContent(2) + + b.EditFileReplaceAll("content/posts/p1.adoc", "P1 Content.", "P1 Content Edited.").Build() + + b.AssertFileContent("public/posts/p1/index.html", "Single: P1|
\n

P1 Content Edited.

\n
\n|") + b.AssertRenderCountPage(1) + b.AssertRenderCountContent(1) +}