aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib/testhelpers_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2019-09-06 09:28:43 +0200
committerBjørn Erik Pedersen <[email protected]>2019-09-06 11:04:57 +0200
commit9442937d82005b369780edcc557e0d15d6bf0bad (patch)
tree270776dff37cd161a56253a0284ad07bcb70af37 /hugolib/testhelpers_test.go
parent901077c0364eaf3fe4f997c3026aa18cfc7781ed (diff)
downloadhugo-9442937d82005b369780edcc557e0d15d6bf0bad.tar.gz
hugo-9442937d82005b369780edcc557e0d15d6bf0bad.zip
Avoid writing the same processed image to /public twice
Fixes #6307
Diffstat (limited to 'hugolib/testhelpers_test.go')
-rw-r--r--hugolib/testhelpers_test.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/hugolib/testhelpers_test.go b/hugolib/testhelpers_test.go
index 6e62a2442..6e00a8ee0 100644
--- a/hugolib/testhelpers_test.go
+++ b/hugolib/testhelpers_test.go
@@ -486,6 +486,8 @@ func (s *sitesBuilder) CreateSitesE() error {
return errors.Wrap(err, "failed to load config")
}
+ s.Fs.Destination = hugofs.NewCreateCountingFs(s.Fs.Destination)
+
depsCfg := s.depsCfg
depsCfg.Fs = s.Fs
depsCfg.Cfg = s.Cfg
@@ -680,6 +682,12 @@ func (s *sitesBuilder) AssertImage(width, height int, filename string) {
s.Assert(cfg.Height, qt.Equals, height)
}
+func (s *sitesBuilder) AssertNoDuplicateWrites() {
+ s.Helper()
+ d := s.Fs.Destination.(hugofs.DuplicatesReporter)
+ s.Assert(d.ReportDuplicates(), qt.Equals, "")
+}
+
func (s *sitesBuilder) FileContent(filename string) string {
s.T.Helper()
filename = filepath.FromSlash(filename)