-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hugolib: Fix freeze in invalid front matter error case
Fixes #4526
- Loading branch information
Showing
4 changed files
with
95 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package hugolib | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
) | ||
|
||
// https://github.com/gohugoio/hugo/issues/4526 | ||
func TestSiteBuildFailureInvalidPageMetadata(t *testing.T) { | ||
t.Parallel() | ||
|
||
validContentFile := ` | ||
--- | ||
title = "This is good" | ||
--- | ||
Some content. | ||
` | ||
|
||
invalidContentFile := ` | ||
--- | ||
title = "PDF EPUB: Anne Bradstreet: Poems "The Prologue Summary And Analysis EBook Full Text " | ||
--- | ||
Some content. | ||
` | ||
|
||
var contentFiles []string | ||
for i := 0; i <= 30; i++ { | ||
name := fmt.Sprintf("valid%d.md", i) | ||
contentFiles = append(contentFiles, name, validContentFile) | ||
if i%5 == 0 { | ||
name = fmt.Sprintf("invalid%d.md", i) | ||
contentFiles = append(contentFiles, name, invalidContentFile) | ||
} | ||
} | ||
|
||
b := newTestSitesBuilder(t) | ||
b.WithSimpleConfigFile().WithContent(contentFiles...) | ||
b.CreateSites().BuildFail(BuildCfg{}) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters