mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-12 22:10:25 +00:00
chore: require.ErrorContains() is intended, but require.Errorf() is used (#11035)
The two commits in this PR fix test cases which did not work as intended, because `require.Errorf()` was used where `require.ErrorContains()` was intended. The former formats the error output by the test itself when failing, while the latter is to expect the tested error to contain some expected string. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/11035 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Nils Goroll <nils.goroll@uplex.de> Co-committed-by: Nils Goroll <nils.goroll@uplex.de>
This commit is contained in:
parent
22b5dfdaf1
commit
6412ee12d0
2 changed files with 6 additions and 2 deletions
|
|
@ -4,6 +4,7 @@
|
|||
package git
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
|
|
@ -150,7 +151,8 @@ func TestRepository_GetAnnotatedTag(t *testing.T) {
|
|||
// Annotated tag's name should fail
|
||||
tag3, err := bareRepo1.GetAnnotatedTag(aTagName)
|
||||
require.Error(t, err)
|
||||
require.Errorf(t, err, "Length must be 40: %d", len(aTagName))
|
||||
require.ErrorContains(t, err,
|
||||
fmt.Sprintf("length %d has no matched object format: %s", len(aTagName), aTagName))
|
||||
assert.Nil(t, tag3)
|
||||
|
||||
// Lightweight Tag should fail
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue