summaryrefslogtreecommitdiffstats
path: root/modules/git/repo_commit_test.go
diff options
context:
space:
mode:
authorChristian Muehlhaeuser <muesli@gmail.com>2019-07-23 21:28:43 +0200
committerzeripath <art27@cantab.net>2019-07-23 20:28:43 +0100
commit5e4e7d3df023892aa053d7c3e3005ab5f440b2e5 (patch)
tree650de0745b1bf958bc024f3f3aec106925095e37 /modules/git/repo_commit_test.go
parent54d96c79b5b9f3d5d47aed59729ae779968fbecb (diff)
downloadgitea-5e4e7d3df023892aa053d7c3e3005ab5f440b2e5.tar.gz
gitea-5e4e7d3df023892aa053d7c3e3005ab5f440b2e5.zip
Added missing error checks in tests (#7554)
Whenever we assign a value to err, check for it being nil.
Diffstat (limited to 'modules/git/repo_commit_test.go')
-rw-r--r--modules/git/repo_commit_test.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/git/repo_commit_test.go b/modules/git/repo_commit_test.go
index 6761a45b7a..c0fdd1697f 100644
--- a/modules/git/repo_commit_test.go
+++ b/modules/git/repo_commit_test.go
@@ -40,8 +40,9 @@ func TestRepository_GetCommitBranches(t *testing.T) {
func TestGetTagCommitWithSignature(t *testing.T) {
bareRepo1Path := filepath.Join(testReposDir, "repo1_bare")
bareRepo1, err := OpenRepository(bareRepo1Path)
- commit, err := bareRepo1.GetCommit("3ad28a9149a2864384548f3d17ed7f38014c9e8a")
+ assert.NoError(t, err)
+ commit, err := bareRepo1.GetCommit("3ad28a9149a2864384548f3d17ed7f38014c9e8a")
assert.NoError(t, err)
assert.NotNil(t, commit)
assert.NotNil(t, commit.Signature)
@@ -52,6 +53,8 @@ func TestGetTagCommitWithSignature(t *testing.T) {
func TestGetCommitWithBadCommitID(t *testing.T) {
bareRepo1Path := filepath.Join(testReposDir, "repo1_bare")
bareRepo1, err := OpenRepository(bareRepo1Path)
+ assert.NoError(t, err)
+
commit, err := bareRepo1.GetCommit("bad_branch")
assert.Nil(t, commit)
assert.Error(t, err)