-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Closed
Copy link
Description
In the test below, all but the last assertion fail because the value of .Truncated is the opposite of what it should be.
func TestIssue13968(t *testing.T) {
t.Parallel()
files := `
-- hugo.toml --
disableKinds = ['page','rss','section','sitemap','taxonomy','term']
summaryLength = SUMMARY_LENGTH
-- layouts/all.html --
Title: {{ .Title }}|Summary: {{ .Summary }}|Truncated: {{ .Truncated }}|
-- content/_index.md --
---
title: home
---
one two three
`
tests := []struct {
summaryLength int
want string
}{
{0, "Title: home|Summary: |Truncated: true|"}, // fails
{1, "Title: home|Summary: <p>one two three</p>|Truncated: false|"}, // fails
{2, "Title: home|Summary: <p>one two three</p>|Truncated: false|"}, // fails
{3, "Title: home|Summary: <p>one two three</p>|Truncated: false|"}, // fails
{4, "Title: home|Summary: <p>one two three</p>|Truncated: false|"},
}
for _, tt := range tests {
f := strings.ReplaceAll(files, "SUMMARY_LENGTH", strconv.Itoa(tt.summaryLength))
b := hugolib.Test(t, f)
b.AssertFileContent("public/index.html", tt.want)
}
}