diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-01-30 09:23:21 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-01-30 20:12:03 +0100 |
commit | 4e84f57efb57f5c8a850e4c1d562a0bcc7bd1700 (patch) | |
tree | 678ed4f283b67339c341ad355306ca0d5d771ad8 /hugolib/integrationtest_builder.go | |
parent | f31a6db797c9251a362ef9f8ad4c03fb608b5ac0 (diff) | |
download | hugo-4e84f57efb57f5c8a850e4c1d562a0bcc7bd1700.tar.gz hugo-4e84f57efb57f5c8a850e4c1d562a0bcc7bd1700.zip |
Add warnidf template function
Also rename config `ignoreErrors` => `ignoreLogs`
But the old still works.
Closes #9189
Diffstat (limited to 'hugolib/integrationtest_builder.go')
-rw-r--r-- | hugolib/integrationtest_builder.go | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/hugolib/integrationtest_builder.go b/hugolib/integrationtest_builder.go index a46ae7275..222c8ec2d 100644 --- a/hugolib/integrationtest_builder.go +++ b/hugolib/integrationtest_builder.go @@ -57,6 +57,13 @@ func TestOptDebug() TestOpt { } } +// TestOptWarn will enable warn logging in integration tests. +func TestOptWarn() TestOpt { + return func(c *IntegrationTestConfig) { + c.LogLevel = logg.LevelWarn + } +} + // TestOptWithNFDOnDarwin will normalize the Unicode filenames to NFD on Darwin. func TestOptWithNFDOnDarwin() TestOpt { return func(c *IntegrationTestConfig) { @@ -181,9 +188,18 @@ func (b *lockingBuffer) Write(p []byte) (n int, err error) { return } -func (s *IntegrationTestBuilder) AssertLogContains(text string) { +func (s *IntegrationTestBuilder) AssertLogContains(els ...string) { s.Helper() - s.Assert(s.logBuff.String(), qt.Contains, text) + for _, el := range els { + s.Assert(s.logBuff.String(), qt.Contains, el) + } +} + +func (s *IntegrationTestBuilder) AssertLogNotContains(els ...string) { + s.Helper() + for _, el := range els { + s.Assert(s.logBuff.String(), qt.Not(qt.Contains), el) + } } func (s *IntegrationTestBuilder) AssertLogMatches(expression string) { |