Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'hugofs/fs_test.go')
-rw-r--r--hugofs/fs_test.go48
1 files changed, 28 insertions, 20 deletions
diff --git a/hugofs/fs_test.go b/hugofs/fs_test.go
index 8d52267af..f7203fac9 100644
--- a/hugofs/fs_test.go
+++ b/hugofs/fs_test.go
@@ -23,38 +23,46 @@ import (
"github.com/spf13/afero"
)
+func TestIsOsFs(t *testing.T) {
+ c := qt.New(t)
+
+ c.Assert(IsOsFs(Os), qt.Equals, true)
+ c.Assert(IsOsFs(&afero.MemMapFs{}), qt.Equals, false)
+ c.Assert(IsOsFs(afero.NewBasePathFs(&afero.MemMapFs{}, "/public")), qt.Equals, false)
+ c.Assert(IsOsFs(afero.NewBasePathFs(Os, t.TempDir())), qt.Equals, true)
+
+}
+
func TestNewDefault(t *testing.T) {
c := qt.New(t)
- v := config.New()
+ v := config.NewWithTestDefaults()
+ v.Set("workingDir", t.TempDir())
f := NewDefault(v)
- c.Assert(f.Source, qt.Not(qt.IsNil))
+ c.Assert(f.Source, qt.IsNotNil)
c.Assert(f.Source, hqt.IsSameType, new(afero.OsFs))
- c.Assert(f.Os, qt.Not(qt.IsNil))
- c.Assert(f.WorkingDir, qt.IsNil)
+ c.Assert(f.Os, qt.IsNotNil)
+ c.Assert(f.WorkingDirReadOnly, qt.IsNotNil)
+ c.Assert(f.WorkingDirReadOnly, hqt.IsSameType, new(afero.BasePathFs))
+ c.Assert(IsOsFs(f.Source), qt.IsTrue)
+ c.Assert(IsOsFs(f.WorkingDirReadOnly), qt.IsTrue)
+ c.Assert(IsOsFs(f.PublishDir), qt.IsTrue)
+ c.Assert(IsOsFs(f.Os), qt.IsTrue)
}
func TestNewMem(t *testing.T) {
c := qt.New(t)
- v := config.New()
+ v := config.NewWithTestDefaults()
f := NewMem(v)
c.Assert(f.Source, qt.Not(qt.IsNil))
c.Assert(f.Source, hqt.IsSameType, new(afero.MemMapFs))
- c.Assert(f.Destination, qt.Not(qt.IsNil))
- c.Assert(f.Destination, hqt.IsSameType, new(afero.MemMapFs))
+ c.Assert(f.PublishDir, qt.Not(qt.IsNil))
+ c.Assert(f.PublishDir, hqt.IsSameType, new(afero.BasePathFs))
c.Assert(f.Os, hqt.IsSameType, new(afero.OsFs))
- c.Assert(f.WorkingDir, qt.IsNil)
-}
-
-func TestWorkingDir(t *testing.T) {
- c := qt.New(t)
- v := config.New()
-
- v.Set("workingDir", "/a/b/")
-
- f := NewMem(v)
-
- c.Assert(f.WorkingDir, qt.Not(qt.IsNil))
- c.Assert(f.WorkingDir, hqt.IsSameType, new(afero.BasePathFs))
+ c.Assert(f.WorkingDirReadOnly, qt.IsNotNil)
+ c.Assert(IsOsFs(f.Source), qt.IsFalse)
+ c.Assert(IsOsFs(f.WorkingDirReadOnly), qt.IsFalse)
+ c.Assert(IsOsFs(f.PublishDir), qt.IsFalse)
+ c.Assert(IsOsFs(f.Os), qt.IsTrue)
}