mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
@@ -19,10 +19,12 @@ import (
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/spf13/hugo/hugofs"
|
||||
)
|
||||
|
||||
func TestEmptySourceFilesystem(t *testing.T) {
|
||||
src := &Filesystem{Base: "Empty"}
|
||||
src := NewFilesystem(hugofs.NewMem(), "Empty")
|
||||
if len(src.Files()) != 0 {
|
||||
t.Errorf("new filesystem should contain 0 files.")
|
||||
}
|
||||
@@ -37,13 +39,12 @@ type TestPath struct {
|
||||
}
|
||||
|
||||
func TestAddFile(t *testing.T) {
|
||||
fs := hugofs.NewMem()
|
||||
tests := platformPaths
|
||||
for _, test := range tests {
|
||||
base := platformBase
|
||||
srcDefault := new(Filesystem)
|
||||
srcWithBase := &Filesystem{
|
||||
Base: base,
|
||||
}
|
||||
srcDefault := NewFilesystem(fs, "")
|
||||
srcWithBase := NewFilesystem(fs, base)
|
||||
|
||||
for _, src := range []*Filesystem{srcDefault, srcWithBase} {
|
||||
|
||||
@@ -99,8 +100,10 @@ func TestUnicodeNorm(t *testing.T) {
|
||||
{NFC: "é", NFD: "\x65\xcc\x81"},
|
||||
}
|
||||
|
||||
fs := hugofs.NewMem()
|
||||
|
||||
for _, path := range paths {
|
||||
src := new(Filesystem)
|
||||
src := NewFilesystem(fs, "")
|
||||
_ = src.add(path.NFD, strings.NewReader(""))
|
||||
f := src.Files()[0]
|
||||
if f.BaseFileName() != path.NFC {
|
||||
|
Reference in New Issue
Block a user