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
path: root/source
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-08-10 22:05:17 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-08-12 14:26:32 +0300
commit9e571827055dedb46b78c5db3d17d6913f14870b (patch)
treef5f0108afe0c9385ff6dc27664943d9f719f57ad /source
parent6027ee11082d0b9d72de1d4d1980a702be294ad2 (diff)
tests: Convert from testify to quicktest
Diffstat (limited to 'source')
-rw-r--r--source/content_directory_test.go6
-rw-r--r--source/fileInfo_test.go28
-rw-r--r--source/filesystem_test.go12
3 files changed, 23 insertions, 23 deletions
diff --git a/source/content_directory_test.go b/source/content_directory_test.go
index 46fd7813e..d3723c6b1 100644
--- a/source/content_directory_test.go
+++ b/source/content_directory_test.go
@@ -19,12 +19,12 @@ import (
"github.com/gohugoio/hugo/helpers"
+ qt "github.com/frankban/quicktest"
"github.com/gohugoio/hugo/hugofs"
- "github.com/stretchr/testify/require"
)
func TestIgnoreDotFilesAndDirectories(t *testing.T) {
- assert := require.New(t)
+ c := qt.New(t)
tests := []struct {
path string
@@ -55,7 +55,7 @@ func TestIgnoreDotFilesAndDirectories(t *testing.T) {
v.Set("ignoreFiles", test.ignoreFilesRegexpes)
fs := hugofs.NewMem(v)
ps, err := helpers.NewPathSpec(fs, v, nil)
- assert.NoError(err)
+ c.Assert(err, qt.IsNil)
s := NewSourceSpec(ps, fs.Source)
diff --git a/source/fileInfo_test.go b/source/fileInfo_test.go
index 0c024de18..1c9da7e41 100644
--- a/source/fileInfo_test.go
+++ b/source/fileInfo_test.go
@@ -18,11 +18,11 @@ import (
"strings"
"testing"
- "github.com/stretchr/testify/require"
+ qt "github.com/frankban/quicktest"
)
func TestFileInfo(t *testing.T) {
- assert := require.New(t)
+ c := qt.New(t)
s := newTestSourceSpec()
@@ -32,29 +32,29 @@ func TestFileInfo(t *testing.T) {
assert func(f *FileInfo)
}{
{filepath.FromSlash("/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())
- assert.Equal("b", f.Section())
- assert.Equal(filepath.FromSlash("page"), f.TranslationBaseName())
- assert.Equal(filepath.FromSlash("page"), f.BaseFileName())
+ c.Assert(f.Filename(), qt.Equals, filepath.FromSlash("/a/b/page.md"))
+ c.Assert(f.Dir(), qt.Equals, filepath.FromSlash("b/"))
+ c.Assert(f.Path(), qt.Equals, filepath.FromSlash("b/page.md"))
+ c.Assert(f.Section(), qt.Equals, "b")
+ c.Assert(f.TranslationBaseName(), qt.Equals, filepath.FromSlash("page"))
+ c.Assert(f.BaseFileName(), qt.Equals, filepath.FromSlash("page"))
}},
{filepath.FromSlash("/a/"), filepath.FromSlash("/a/b/c/d/page.md"), func(f *FileInfo) {
- assert.Equal("b", f.Section())
+ c.Assert(f.Section(), qt.Equals, "b")
}},
{filepath.FromSlash("/a/"), filepath.FromSlash("/a/b/page.en.MD"), func(f *FileInfo) {
- assert.Equal("b", f.Section())
- assert.Equal(filepath.FromSlash("b/page.en.MD"), f.Path())
- assert.Equal(filepath.FromSlash("page"), f.TranslationBaseName())
- assert.Equal(filepath.FromSlash("page.en"), f.BaseFileName())
+ c.Assert(f.Section(), qt.Equals, "b")
+ c.Assert(f.Path(), qt.Equals, filepath.FromSlash("b/page.en.MD"))
+ c.Assert(f.TranslationBaseName(), qt.Equals, filepath.FromSlash("page"))
+ c.Assert(f.BaseFileName(), qt.Equals, filepath.FromSlash("page.en"))
}},
} {
path := strings.TrimPrefix(this.filename, this.base)
f, err := s.NewFileInfoFrom(path, this.filename)
- assert.NoError(err)
+ c.Assert(err, qt.IsNil)
this.assert(f)
}
diff --git a/source/filesystem_test.go b/source/filesystem_test.go
index fd3ff1952..ec7a305dc 100644
--- a/source/filesystem_test.go
+++ b/source/filesystem_test.go
@@ -25,19 +25,19 @@ import (
"github.com/spf13/afero"
+ qt "github.com/frankban/quicktest"
"github.com/gohugoio/hugo/helpers"
"github.com/gohugoio/hugo/hugofs"
- "github.com/stretchr/testify/require"
"github.com/spf13/viper"
)
func TestEmptySourceFilesystem(t *testing.T) {
- assert := require.New(t)
+ c := qt.New(t)
ss := newTestSourceSpec()
src := ss.NewFilesystem("")
files, err := src.Files()
- assert.NoError(err)
+ c.Assert(err, qt.IsNil)
if len(files) != 0 {
t.Errorf("new filesystem should contain 0 files.")
}
@@ -49,7 +49,7 @@ func TestUnicodeNorm(t *testing.T) {
return
}
- assert := require.New(t)
+ c := qt.New(t)
paths := []struct {
NFC string
@@ -64,11 +64,11 @@ func TestUnicodeNorm(t *testing.T) {
for i, path := range paths {
base := fmt.Sprintf("base%d", i)
- assert.NoError(afero.WriteFile(ss.Fs.Source, filepath.Join(base, path.NFD), []byte("some data"), 0777))
+ c.Assert(afero.WriteFile(ss.Fs.Source, filepath.Join(base, path.NFD), []byte("some data"), 0777), qt.IsNil)
src := ss.NewFilesystem(base)
_ = src.add(path.NFD, fi)
files, err := src.Files()
- assert.NoError(err)
+ c.Assert(err, qt.IsNil)
f := files[0]
if f.BaseFileName() != path.NFC {
t.Fatalf("file %q name in NFD form should be normalized (%s)", f.BaseFileName(), path.NFC)