mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
@@ -49,3 +49,29 @@ START:|{{ range $entry := $entries }}{{ if not $entry.IsDir }}{{ $entry.Name }}|
|
||||
START:|config.toml|myproject.txt|:END:
|
||||
`)
|
||||
}
|
||||
|
||||
// Issue 9620
|
||||
func TestReadFileNotExists(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
files := `
|
||||
-- config.toml --
|
||||
-- layouts/index.html --
|
||||
{{ $fi := (readFile "doesnotexist") }}
|
||||
{{ if $fi }}Failed{{ else }}OK{{ end }}
|
||||
|
||||
|
||||
`
|
||||
|
||||
b := hugolib.NewIntegrationTestBuilder(
|
||||
hugolib.IntegrationTestConfig{
|
||||
T: t,
|
||||
TxtarString: files,
|
||||
NeedsOsFS: true,
|
||||
},
|
||||
).Build()
|
||||
|
||||
b.AssertFileContent("public/index.html", `
|
||||
OK
|
||||
`)
|
||||
}
|
||||
|
Reference in New Issue
Block a user