aboutsummaryrefslogtreecommitdiffstats
path: root/modules/git
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2023-04-22 23:56:27 +0200
committerGitHub <noreply@github.com>2023-04-22 17:56:27 -0400
commitf1173d6879cb26af21483037fae72542f3088408 (patch)
treea1ed73fb2a42c351005974698076f5ee82489d5d /modules/git
parentac384c4e1d207a989d0f646ebc14fd0c26427d4c (diff)
downloadgitea-f1173d6879cb26af21483037fae72542f3088408.tar.gz
gitea-f1173d6879cb26af21483037fae72542f3088408.zip
Use more specific test methods (#24265)
Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'modules/git')
-rw-r--r--modules/git/repo_attribute_test.go4
-rw-r--r--modules/git/repo_commit_test.go2
-rw-r--r--modules/git/repo_tag_test.go2
3 files changed, 4 insertions, 4 deletions
diff --git a/modules/git/repo_attribute_test.go b/modules/git/repo_attribute_test.go
index f88ae95407..350b69dd25 100644
--- a/modules/git/repo_attribute_test.go
+++ b/modules/git/repo_attribute_test.go
@@ -19,7 +19,7 @@ func Test_nulSeparatedAttributeWriter_ReadAttribute(t *testing.T) {
n, err := wr.Write([]byte(testStr))
- assert.Equal(t, n, len(testStr))
+ assert.Len(t, testStr, n)
assert.NoError(t, err)
select {
case attr := <-wr.ReadAttribute():
@@ -32,7 +32,7 @@ func Test_nulSeparatedAttributeWriter_ReadAttribute(t *testing.T) {
// Write a second attribute again
n, err = wr.Write([]byte(testStr))
- assert.Equal(t, n, len(testStr))
+ assert.Len(t, testStr, n)
assert.NoError(t, err)
select {
diff --git a/modules/git/repo_commit_test.go b/modules/git/repo_commit_test.go
index 729fb0ba10..fee145e924 100644
--- a/modules/git/repo_commit_test.go
+++ b/modules/git/repo_commit_test.go
@@ -97,6 +97,6 @@ func TestRepository_CommitsBetweenIDs(t *testing.T) {
for i, c := range cases {
commits, err := bareRepo1.CommitsBetweenIDs(c.NewID, c.OldID)
assert.NoError(t, err)
- assert.Equal(t, c.ExpectedCommits, len(commits), "case %d", i)
+ assert.Len(t, commits, c.ExpectedCommits, "case %d", i)
}
}
diff --git a/modules/git/repo_tag_test.go b/modules/git/repo_tag_test.go
index 8ccfec3eb2..fb6a7cdd1a 100644
--- a/modules/git/repo_tag_test.go
+++ b/modules/git/repo_tag_test.go
@@ -26,7 +26,7 @@ func TestRepository_GetTags(t *testing.T) {
return
}
assert.Len(t, tags, 2)
- assert.Equal(t, len(tags), total)
+ assert.Len(t, tags, total)
assert.EqualValues(t, "signed-tag", tags[0].Name)
assert.EqualValues(t, "36f97d9a96457e2bab511db30fe2db03893ebc64", tags[0].ID.String())
assert.EqualValues(t, "tag", tags[0].Type)