diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-04-23 22:03:25 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2017-04-23 22:46:01 +0200 |
commit | 0e87b18b66d2c8ba9e2abc429630cb03f5b093d6 (patch) | |
tree | 49f58317681a67aae9f90def687e069c1f63cc3a /hugolib/site_test.go | |
parent | e98f885b8af27f5473a89d31d0b1f02e61e8a5ec (diff) | |
download | hugo-0e87b18b66d2c8ba9e2abc429630cb03f5b093d6.tar.gz hugo-0e87b18b66d2c8ba9e2abc429630cb03f5b093d6.zip |
hugolib: Fix handling of zero-length files
This was a regression in Hugo 0.20. This commit makes sure that zeron-length files are not rendered to file.
Fixes #3355
Diffstat (limited to 'hugolib/site_test.go')
-rw-r--r-- | hugolib/site_test.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/hugolib/site_test.go b/hugolib/site_test.go index e18456bf9..1df3c81c7 100644 --- a/hugolib/site_test.go +++ b/hugolib/site_test.go @@ -376,6 +376,20 @@ func TestNewSiteDefaultLang(t *testing.T) { require.Equal(t, hugofs.Os, s.Fs.Destination) } +// Issue #3355 +func TestShouldNotWriteZeroLengthFilesToDestination(t *testing.T) { + cfg, fs := newTestCfg() + + writeSource(t, fs, filepath.Join("content", "simple.html"), "simple") + writeSource(t, fs, filepath.Join("layouts", "_default/single.html"), "{{.Content}}") + writeSource(t, fs, filepath.Join("layouts", "_default/list.html"), "") + + s := buildSingleSite(t, deps.DepsCfg{Fs: fs, Cfg: cfg}, BuildCfg{}) + th := testHelper{s.Cfg, s.Fs, t} + + th.assertFileNotExist(filepath.Join("public", "index.html")) +} + // Issue #1176 func TestSectionNaming(t *testing.T) { t.Parallel() |