summaryrefslogtreecommitdiffstats
path: root/source/filesystem_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-02-05 10:20:06 +0700
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-02-17 17:15:26 +0100
commit93ca7c9e958e34469a337e4efcc7c75774ec50fd (patch)
tree5dfa296cfe74fd5ef8f0d41ea4078704f453aa04 /source/filesystem_test.go
parente34af6ee30f70f5780a281e2fd8f4ed9b487ee61 (diff)
downloadhugo-93ca7c9e958e34469a337e4efcc7c75774ec50fd.tar.gz
hugo-93ca7c9e958e34469a337e4efcc7c75774ec50fd.zip
all: Refactor to nonglobal Viper, i18n etc.
This is a final rewrite that removes all the global state in Hugo, which also enables the use if `t.Parallel` in tests. Updates #2701 Fixes #3016
Diffstat (limited to 'source/filesystem_test.go')
-rw-r--r--source/filesystem_test.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/source/filesystem_test.go b/source/filesystem_test.go
index 598a1b81d..90512ce3f 100644
--- a/source/filesystem_test.go
+++ b/source/filesystem_test.go
@@ -19,12 +19,11 @@ import (
"runtime"
"strings"
"testing"
-
- "github.com/spf13/hugo/hugofs"
)
func TestEmptySourceFilesystem(t *testing.T) {
- src := NewFilesystem(hugofs.NewMem(), "Empty")
+ ss := newTestSourceSpec()
+ src := ss.NewFilesystem("Empty")
if len(src.Files()) != 0 {
t.Errorf("new filesystem should contain 0 files.")
}
@@ -39,12 +38,12 @@ type TestPath struct {
}
func TestAddFile(t *testing.T) {
- fs := hugofs.NewMem()
+ ss := newTestSourceSpec()
tests := platformPaths
for _, test := range tests {
base := platformBase
- srcDefault := NewFilesystem(fs, "")
- srcWithBase := NewFilesystem(fs, base)
+ srcDefault := ss.NewFilesystem("")
+ srcWithBase := ss.NewFilesystem(base)
for _, src := range []*Filesystem{srcDefault, srcWithBase} {
@@ -100,10 +99,10 @@ func TestUnicodeNorm(t *testing.T) {
{NFC: "é", NFD: "\x65\xcc\x81"},
}
- fs := hugofs.NewMem()
+ ss := newTestSourceSpec()
for _, path := range paths {
- src := NewFilesystem(fs, "")
+ src := ss.NewFilesystem("")
_ = src.add(path.NFD, strings.NewReader(""))
f := src.Files()[0]
if f.BaseFileName() != path.NFC {