diff options
author | Bjørn Erik Pedersen <[email protected]> | 2023-11-02 09:50:18 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2023-11-02 09:50:18 +0100 |
commit | cee3a56a918c485d445107bf50f2f66d3420a2ce (patch) | |
tree | 3b0f54079f5ce56d7bf97110a91e9b2959f6f3c4 | |
parent | da2a8e6402f03b586e40b1fbc9c20f03ec4973a7 (diff) | |
download | hugo-cee3a56a918c485d445107bf50f2f66d3420a2ce.tar.gz hugo-cee3a56a918c485d445107bf50f2f66d3420a2ce.zip |
Add a new test helper
-rw-r--r-- | hugolib/integrationtest_builder.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/hugolib/integrationtest_builder.go b/hugolib/integrationtest_builder.go index 14509657a..a0cae1d95 100644 --- a/hugolib/integrationtest_builder.go +++ b/hugolib/integrationtest_builder.go @@ -196,6 +196,20 @@ func (s *IntegrationTestBuilder) AssertFileContentExact(filename string, matches } } +func (s *IntegrationTestBuilder) AssertFileExists(filename string, b bool) { + checker := qt.IsNil + if !b { + checker = qt.IsNotNil + } + _, err := s.fs.WorkingDirReadOnly.Stat(filename) + if !herrors.IsNotExist(err) { + s.Assert(err, qt.IsNil) + } + s.Assert(err, checker) +} + +// Deprecated: Use AssertFileExists instead but remember to prefix with "public/". +// I have had some surprises with this one, hence the deprecation. func (s *IntegrationTestBuilder) AssertDestinationExists(filename string, b bool) { checker := qt.IsTrue if !b { |