mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-27 22:21:07 +03:00
Optimize the multilanguage build process
Work In Progress! This commit makes a rework of the build and rebuild process to better suit a multi-site setup. This also includes a complete overhaul of the site tests. Previous these were a messy mix that were testing just small parts of the build chain, some of it testing code-paths not even used in "real life". Now all tests that depends on a built site follows the same and real production code path. See #2309 Closes #2211 Closes #477 Closes #1744
This commit is contained in:
parent
f023dfd763
commit
708bc78770
35 changed files with 1264 additions and 991 deletions
|
@ -15,6 +15,7 @@ package hugolib
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/spf13/hugo/helpers"
|
||||
|
@ -45,28 +46,23 @@ const rssTemplate = `<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"
|
|||
</rss>`
|
||||
|
||||
func TestRSSOutput(t *testing.T) {
|
||||
viper.Reset()
|
||||
defer viper.Reset()
|
||||
testCommonResetState()
|
||||
|
||||
rssURI := "customrss.xml"
|
||||
rssURI := "public/customrss.xml"
|
||||
viper.Set("baseurl", "http://auth/bub/")
|
||||
viper.Set("RSSUri", rssURI)
|
||||
|
||||
hugofs.InitMemFs()
|
||||
s := &Site{
|
||||
Source: &source.InMemorySource{ByteSource: weightedSources},
|
||||
Lang: newDefaultLanguage(),
|
||||
}
|
||||
s.initializeSiteInfo()
|
||||
s.prepTemplates("rss.xml", rssTemplate)
|
||||
|
||||
createPagesAndMeta(t, s)
|
||||
|
||||
if err := s.renderHomePage(); err != nil {
|
||||
t.Fatalf("Unable to RenderHomePage: %s", err)
|
||||
Source: &source.InMemorySource{ByteSource: weightedSources},
|
||||
Language: newDefaultLanguage(),
|
||||
}
|
||||
|
||||
file, err := hugofs.Destination().Open(rssURI)
|
||||
if err := buildAndRenderSite(s, "rss.xml", rssTemplate); err != nil {
|
||||
t.Fatalf("Failed to build site: %s", err)
|
||||
}
|
||||
|
||||
file, err := hugofs.Destination().Open(filepath.Join("public", rssURI))
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("Unable to locate: %s", rssURI)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue