hugolib: Test helper cleanup

This commit is contained in:
Bjørn Erik Pedersen
2017-02-17 20:52:50 +01:00
parent 10c13f5d79
commit ed847ed93d
14 changed files with 214 additions and 208 deletions

View File

@@ -36,7 +36,7 @@ func TestAlias(t *testing.T) {
var (
cfg, fs = newTestCfg()
th = testHelper{cfg}
th = testHelper{cfg, fs, t}
)
writeSource(t, fs, filepath.Join("content", "page.md"), pageWithAlias)
@@ -45,9 +45,9 @@ func TestAlias(t *testing.T) {
buildSingleSite(t, deps.DepsCfg{Fs: fs, Cfg: cfg}, BuildCfg{})
// the real page
th.assertFileContent(t, fs, filepath.Join("public", "page", "index.html"), false, "For some moments the old man")
th.assertFileContent(filepath.Join("public", "page", "index.html"), false, "For some moments the old man")
// the alias redirector
th.assertFileContent(t, fs, filepath.Join("public", "foo", "bar", "index.html"), false, "<meta http-equiv=\"refresh\" content=\"0; ")
th.assertFileContent(filepath.Join("public", "foo", "bar", "index.html"), false, "<meta http-equiv=\"refresh\" content=\"0; ")
}
func TestAliasTemplate(t *testing.T) {
@@ -55,7 +55,7 @@ func TestAliasTemplate(t *testing.T) {
var (
cfg, fs = newTestCfg()
th = testHelper{cfg}
th = testHelper{cfg, fs, t}
)
writeSource(t, fs, filepath.Join("content", "page.md"), pageWithAlias)
@@ -69,7 +69,7 @@ func TestAliasTemplate(t *testing.T) {
require.NoError(t, sites.Build(BuildCfg{}))
// the real page
th.assertFileContent(t, fs, filepath.Join("public", "page", "index.html"), false, "For some moments the old man")
th.assertFileContent(filepath.Join("public", "page", "index.html"), false, "For some moments the old man")
// the alias redirector
th.assertFileContent(t, fs, filepath.Join("public", "foo", "bar", "index.html"), false, "ALIASTEMPLATE")
th.assertFileContent(filepath.Join("public", "foo", "bar", "index.html"), false, "ALIASTEMPLATE")
}