mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-28 06:30:33 +03:00
parent
e88d798990
commit
bd98182dbd
11 changed files with 496 additions and 73 deletions
|
@ -649,9 +649,16 @@ func (s *sitesBuilder) AssertHome(matches ...string) {
|
|||
func (s *sitesBuilder) AssertFileContent(filename string, matches ...string) {
|
||||
s.T.Helper()
|
||||
content := s.FileContent(filename)
|
||||
for _, match := range matches {
|
||||
if !strings.Contains(content, match) {
|
||||
s.Fatalf("No match for %q in content for %s\n%s\n%q", match, filename, content, content)
|
||||
for _, m := range matches {
|
||||
lines := strings.Split(m, "\n")
|
||||
for _, match := range lines {
|
||||
match = strings.TrimSpace(match)
|
||||
if match == "" {
|
||||
continue
|
||||
}
|
||||
if !strings.Contains(content, match) {
|
||||
s.Fatalf("No match for %q in content for %s\n%s\n%q", match, filename, content, content)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue