Stop Viper from leaking across many of the tests (now tests pass regardless of order tested)

This commit is contained in:
spf13
2015-05-20 02:21:21 -04:00
parent 599d1b9786
commit a584ff207b
15 changed files with 223 additions and 101 deletions

View File

@@ -4,12 +4,13 @@ import (
"path/filepath"
"testing"
"html/template"
"github.com/spf13/afero"
"github.com/spf13/hugo/hugofs"
"github.com/spf13/hugo/source"
"github.com/spf13/hugo/target"
"github.com/spf13/viper"
"html/template"
)
const SLUG_DOC_1 = "---\ntitle: slug doc 1\nslug: slug-doc-1\naliases:\n - sd1/foo/\n - sd2\n - sd3/\n - sd4.html\n---\nslug doc 1 content\n"
@@ -54,6 +55,8 @@ var urlFakeSource = []source.ByteSource{
// Issue #1105
func TestShouldNotAddTrailingSlashToBaseURL(t *testing.T) {
viper.Reset()
defer viper.Reset()
for i, this := range []struct {
in string
@@ -76,6 +79,9 @@ func TestShouldNotAddTrailingSlashToBaseURL(t *testing.T) {
}
func TestPageCount(t *testing.T) {
viper.Reset()
defer viper.Reset()
hugofs.DestinationFS = new(afero.MemMapFs)
viper.Set("uglyurls", false)