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 'source/fileInfo_test.go')
-rw-r--r--source/fileInfo_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/source/fileInfo_test.go b/source/fileInfo_test.go
index 3f99497ad..1d7c86ec2 100644
--- a/source/fileInfo_test.go
+++ b/source/fileInfo_test.go
@@ -14,9 +14,31 @@
package source
import (
+ "path/filepath"
"testing"
+
+ "github.com/stretchr/testify/require"
)
func TestFileInfo(t *testing.T) {
+ assert := require.New(t)
+
+ s := newTestSourceSpec()
+
+ for _, this := range []struct {
+ base string
+ filename string
+ assert func(f *FileInfo)
+ }{
+ {"/a/", filepath.FromSlash("/a/b/page.md"), func(f *FileInfo) {
+ assert.Equal(filepath.FromSlash("/a/b/page.md"), f.Filename())
+ assert.Equal(filepath.FromSlash("b/"), f.Dir())
+ assert.Equal(filepath.FromSlash("b/page.md"), f.Path())
+
+ }},
+ } {
+ f := s.NewFileInfo(this.base, this.filename, nil)
+ this.assert(f)
+ }
}