summaryrefslogtreecommitdiffstats
path: root/hugolib/site_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-11-08 23:34:52 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-11-22 09:57:03 +0100
commitbde1bfd34a7b5e5959da6f59a497a190067534cb (patch)
treeaa2c5fef70be81cc80a2883b0ab43c2982ac8bbb /hugolib/site_test.go
parentec2d502b4f214b9505dcd57713d2236c606985e8 (diff)
node to page: Handle aliases, 404, robots.txt, sitemap
Updates #2297
Diffstat (limited to 'hugolib/site_test.go')
-rw-r--r--hugolib/site_test.go20
1 files changed, 6 insertions, 14 deletions
diff --git a/hugolib/site_test.go b/hugolib/site_test.go
index b71548c46..500e1b65c 100644
--- a/hugolib/site_test.go
+++ b/hugolib/site_test.go
@@ -393,6 +393,7 @@ func doTestShouldAlwaysHaveUglyURLs(t *testing.T, uglyURLs bool) {
// Issue #1176
func TestSectionNaming(t *testing.T) {
+ //jww.SetStdoutThreshold(jww.LevelDebug)
for _, canonify := range []bool{true, false} {
for _, uglify := range []bool{true, false} {
@@ -404,7 +405,6 @@ func TestSectionNaming(t *testing.T) {
}
func doTestSectionNaming(t *testing.T, canonify, uglify, pluralize bool) {
- hugofs.InitMemFs()
testCommonResetState()
viper.Set("baseURL", "http://auth/sub/")
@@ -427,12 +427,12 @@ func doTestSectionNaming(t *testing.T, canonify, uglify, pluralize bool) {
{Name: filepath.FromSlash("ラーメン/doc3.html"), Content: []byte("doc3")},
}
- s := &Site{
- Source: &source.InMemorySource{ByteSource: sources},
- targets: targetList{page: &target.PagePub{UglyURLs: uglify}},
- Language: helpers.NewDefaultLanguage(),
+ for _, source := range sources {
+ writeSource(t, filepath.Join("content", source.Name), string(source.Content))
}
+ s := newSiteDefaultLang()
+
if err := buildAndRenderSite(s,
"_default/single.html", "{{.Content}}",
"_default/list.html", "{{ .Title }}"); err != nil {
@@ -453,20 +453,12 @@ func doTestSectionNaming(t *testing.T, canonify, uglify, pluralize bool) {
}
for _, test := range tests {
- file, err := hugofs.Destination().Open(test.doc)
- if err != nil {
- t.Fatalf("Did not find %s in target: %s", test.doc, err)
- }
-
- content := helpers.ReaderToString(file)
if test.pluralAware && pluralize {
test.expected = inflect.Pluralize(test.expected)
}
- if content != test.expected {
- t.Errorf("%s content expected:\n%q\ngot:\n%q", test.doc, test.expected, content)
- }
+ assertFileContent(t, filepath.Join("public", test.doc), true, test.expected)
}
}