summaryrefslogtreecommitdiffhomepage
path: root/releaser
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2019-08-10 21:05:17 +0200
committerBjørn Erik Pedersen <[email protected]>2019-08-12 13:26:32 +0200
commit9e571827055dedb46b78c5db3d17d6913f14870b (patch)
treef5f0108afe0c9385ff6dc27664943d9f719f57ad /releaser
parent6027ee11082d0b9d72de1d4d1980a702be294ad2 (diff)
downloadhugo-9e571827055dedb46b78c5db3d17d6913f14870b.tar.gz
hugo-9e571827055dedb46b78c5db3d17d6913f14870b.zip
tests: Convert from testify to quicktest
Diffstat (limited to 'releaser')
-rw-r--r--releaser/git_test.go29
-rw-r--r--releaser/github_test.go8
-rw-r--r--releaser/releasenotes_writer_test.go7
3 files changed, 25 insertions, 19 deletions
diff --git a/releaser/git_test.go b/releaser/git_test.go
index f0d6fd24b..1c5f78886 100644
--- a/releaser/git_test.go
+++ b/releaser/git_test.go
@@ -16,19 +16,20 @@ package releaser
import (
"testing"
- "github.com/stretchr/testify/require"
+ qt "github.com/frankban/quicktest"
)
func TestGitInfos(t *testing.T) {
+ c := qt.New(t)
skipIfCI(t)
infos, err := getGitInfos("v0.20", "hugo", "", false)
- require.NoError(t, err)
- require.True(t, len(infos) > 0)
-
+ c.Assert(err, qt.IsNil)
+ c.Assert(len(infos) > 0, qt.Equals, true)
}
func TestIssuesRe(t *testing.T) {
+ c := qt.New(t)
body := `
This is a commit message.
@@ -41,28 +42,30 @@ See #456
issues := extractIssues(body)
- require.Len(t, issues, 4)
- require.Equal(t, 123, issues[0])
- require.Equal(t, 543, issues[2])
+ c.Assert(len(issues), qt.Equals, 4)
+ c.Assert(issues[0], qt.Equals, 123)
+ c.Assert(issues[2], qt.Equals, 543)
}
func TestGitVersionTagBefore(t *testing.T) {
skipIfCI(t)
+ c := qt.New(t)
v1, err := gitVersionTagBefore("v0.18")
- require.NoError(t, err)
- require.Equal(t, "v0.17", v1)
+ c.Assert(err, qt.IsNil)
+ c.Assert(v1, qt.Equals, "v0.17")
}
func TestTagExists(t *testing.T) {
skipIfCI(t)
+ c := qt.New(t)
b1, err := tagExists("v0.18")
- require.NoError(t, err)
- require.True(t, b1)
+ c.Assert(err, qt.IsNil)
+ c.Assert(b1, qt.Equals, true)
b2, err := tagExists("adfagdsfg")
- require.NoError(t, err)
- require.False(t, b2)
+ c.Assert(err, qt.IsNil)
+ c.Assert(b2, qt.Equals, false)
}
diff --git a/releaser/github_test.go b/releaser/github_test.go
index 1187cbb2c..23331bf38 100644
--- a/releaser/github_test.go
+++ b/releaser/github_test.go
@@ -18,22 +18,24 @@ import (
"os"
"testing"
- "github.com/stretchr/testify/require"
+ qt "github.com/frankban/quicktest"
)
func TestGitHubLookupCommit(t *testing.T) {
skipIfNoToken(t)
+ c := qt.New(t)
client := newGitHubAPI("hugo")
commit, err := client.fetchCommit("793554108763c0984f1a1b1a6ee5744b560d78d0")
- require.NoError(t, err)
+ c.Assert(err, qt.IsNil)
fmt.Println(commit)
}
func TestFetchRepo(t *testing.T) {
skipIfNoToken(t)
+ c := qt.New(t)
client := newGitHubAPI("hugo")
repo, err := client.fetchRepo()
- require.NoError(t, err)
+ c.Assert(err, qt.IsNil)
fmt.Println(">>", len(repo.Contributors))
}
diff --git a/releaser/releasenotes_writer_test.go b/releaser/releasenotes_writer_test.go
index f5b7a87d3..5013c6522 100644
--- a/releaser/releasenotes_writer_test.go
+++ b/releaser/releasenotes_writer_test.go
@@ -22,7 +22,7 @@ import (
"os"
"testing"
- "github.com/stretchr/testify/require"
+ qt "github.com/frankban/quicktest"
)
func _TestReleaseNotesWriter(t *testing.T) {
@@ -30,14 +30,15 @@ func _TestReleaseNotesWriter(t *testing.T) {
// Travis has an ancient git with no --invert-grep: https://github.com/travis-ci/travis-ci/issues/6328
t.Skip("Skip git test on CI to make Travis happy.")
}
+ c := qt.New(t)
var b bytes.Buffer
// TODO(bep) consider to query GitHub directly for the gitlog with author info, probably faster.
infos, err := getGitInfosBefore("HEAD", "v0.20", "hugo", "", false)
- require.NoError(t, err)
+ c.Assert(err, qt.IsNil)
- require.NoError(t, writeReleaseNotes("0.21", infos, infos, &b))
+ c.Assert(writeReleaseNotes("0.21", infos, infos, &b), qt.IsNil)
fmt.Println(b.String())