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()
}
}
+func (th testHelper) assertFileNotExist(filename string) {
+ exists, err := helpers.Exists(filename, th.Fs.Destination)
+ require.NoError(th.T, err)
+ require.False(th.T, exists)
+}
+
func (th testHelper) replaceDefaultContentLanguageValue(value string) string {
defaultInSubDir := th.Cfg.GetBool("defaultContentLanguageInSubDir")
replace := th.Cfg.GetString("defaultContentLanguage") + "/"