mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
Add a new test helper
This commit is contained in:
parent
da2a8e6402
commit
cee3a56a91
1 changed files with 14 additions and 0 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue