mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 12:44:22 +01:00
refactor: simplify test asserts (#1271)
This commit is contained in:
1 parent
d37b38f2ee
commit
2959fc072c
10 files changed
+151
-297
No files matched your search
@@ -2,6 +2,8 @@ package detect
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
// TestGetLocation tests the getLocation function.
|
||||
@@ -50,11 +52,6 @@ func TestGetLocation(t *testing.T) {
|
||||
|
||||
for _, test := range tests {
|
||||
loc := location(Fragment{newlineIndices: test.linePairs}, []int{test.start, test.end})
|
||||
if loc != test.wantLocation {
|
||||
t.Errorf("\nstartLine %d\nstartColumn: %d\nendLine: %d\nendColumn: %d\nstartLineIndex: %d\nendlineIndex %d",
|
||||
loc.startLine, loc.startColumn, loc.endLine, loc.endColumn, loc.startLineIndex, loc.endLineIndex)
|
||||
|
||||
t.Error("got", loc, "want", test.wantLocation)
|
||||
}
|
||||
assert.Equal(t, test.wantLocation, loc)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user