Skip to content

Commit

Permalink
Add a new test helper
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed Nov 2, 2023
1 parent da2a8e6 commit cee3a56
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions hugolib/integrationtest_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit cee3a56

Please sign in to comment.