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:
Bjørn Erik Pedersen
2016-07-28 09:30:58 +02:00
parent f023dfd763
commit 708bc78770
35 changed files with 1264 additions and 991 deletions

View File

@@ -569,7 +569,7 @@ func TestPageWithDelimiter(t *testing.T) {
func TestPageWithShortCodeInSummary(t *testing.T) {
s := new(Site)
s.prepTemplates()
s.prepTemplates(nil)
p, _ := NewPage("simple.md")
_, err := p.ReadFrom(strings.NewReader(simplePageWithShortcodeInSummary))
if err != nil {
@@ -644,7 +644,7 @@ func TestPageWithDate(t *testing.T) {
}
func TestWordCountWithAllCJKRunesWithoutHasCJKLanguage(t *testing.T) {
viper.Reset()
testCommonResetState()
p, _ := NewPage("simple.md")
_, err := p.ReadFrom(strings.NewReader(simplePageWithAllCJKRunes))
@@ -660,8 +660,7 @@ func TestWordCountWithAllCJKRunesWithoutHasCJKLanguage(t *testing.T) {
}
func TestWordCountWithAllCJKRunesHasCJKLanguage(t *testing.T) {
viper.Reset()
defer viper.Reset()
testCommonResetState()
viper.Set("HasCJKLanguage", true)
@@ -679,8 +678,7 @@ func TestWordCountWithAllCJKRunesHasCJKLanguage(t *testing.T) {
}
func TestWordCountWithMainEnglishWithCJKRunes(t *testing.T) {
viper.Reset()
defer viper.Reset()
testCommonResetState()
viper.Set("HasCJKLanguage", true)
@@ -703,8 +701,7 @@ func TestWordCountWithMainEnglishWithCJKRunes(t *testing.T) {
}
func TestWordCountWithIsCJKLanguageFalse(t *testing.T) {
viper.Reset()
defer viper.Reset()
testCommonResetState()
viper.Set("HasCJKLanguage", true)
@@ -944,8 +941,7 @@ func TestSliceToLower(t *testing.T) {
}
func TestPagePaths(t *testing.T) {
viper.Reset()
defer viper.Reset()
testCommonResetState()
viper.Set("DefaultExtension", "html")
siteParmalinksSetting := PermalinkOverrides{