mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-20 21:31:32 +02:00
@@ -27,16 +27,22 @@ func TestErroridf(t *testing.T) {
|
||||
files := `
|
||||
-- hugo.toml --
|
||||
disableKinds = ['page','rss','section','sitemap','taxonomy','term']
|
||||
ignoreErrors = ['error-b']
|
||||
ignoreErrors = ['error-b','error-C']
|
||||
-- layouts/index.html --
|
||||
{{ erroridf "error-a" "%s" "a"}}
|
||||
{{ erroridf "error-b" "%s" "b"}}
|
||||
{{ erroridf "error-C" "%s" "C"}}
|
||||
{{ erroridf "error-c" "%s" "c"}}
|
||||
{{ erroridf "error-d" "%s" "D"}}
|
||||
`
|
||||
|
||||
b, err := hugolib.TestE(t, files)
|
||||
|
||||
b.Assert(err, qt.IsNotNil)
|
||||
b.AssertLogMatches(`^ERROR a\nYou can suppress this error by adding the following to your site configuration:\nignoreLogs = \['error-a'\]\n$`)
|
||||
b.AssertLogMatches(`ERROR a\nYou can suppress this error by adding the following to your site configuration:\nignoreLogs = \['error-a'\]`)
|
||||
b.AssertLogMatches(`ERROR D`)
|
||||
b.AssertLogMatches(`! ERROR C`)
|
||||
b.AssertLogMatches(`! ERROR c`)
|
||||
}
|
||||
|
||||
func TestWarnidf(t *testing.T) {
|
||||
@@ -45,13 +51,15 @@ func TestWarnidf(t *testing.T) {
|
||||
files := `
|
||||
-- hugo.toml --
|
||||
disableKinds = ['page','rss','section','sitemap','taxonomy','term']
|
||||
ignoreLogs = ['warning-b']
|
||||
ignoreLogs = ['warning-b', 'WarniNg-C']
|
||||
-- layouts/index.html --
|
||||
{{ warnidf "warning-a" "%s" "a"}}
|
||||
{{ warnidf "warning-b" "%s" "b"}}
|
||||
{{ warnidf "warNing-C" "%s" "c"}}
|
||||
`
|
||||
|
||||
b := hugolib.Test(t, files, hugolib.TestOptWarn())
|
||||
b.AssertLogContains("WARN a", "You can suppress this warning", "ignoreLogs", "['warning-a']")
|
||||
b.AssertLogNotContains("['warning-b']")
|
||||
b.AssertLogContains("! ['warning-b']")
|
||||
b.AssertLogContains("! ['warning-c']")
|
||||
}
|
||||
|
Reference in New Issue
Block a user