mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 12:44:22 +01:00
refactor(detect): create readUntilSafeBoundary + add tests (#1676)
This commit is contained in:
1 parent
dbe3746455
commit
4c3da6ebb7
5 files changed
+190
-62
No files matched your search
@@ -1,11 +1,12 @@
|
||||
package detect
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/require"
|
||||
"io"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
@@ -13,11 +14,17 @@ const secret = "AKIAIRYLJVKMPEGZMPJS"
|
||||
|
||||
type mockReader struct {
|
||||
data []byte
|
||||
read bool
|
||||
}
|
||||
|
||||
func (r *mockReader) Read(p []byte) (n int, err error) {
|
||||
if r.read {
|
||||
return 0, io.EOF
|
||||
}
|
||||
|
||||
// Copy data to the provided buffer.
|
||||
n = copy(p, r.data)
|
||||
r.read = true
|
||||
|
||||
// Return io.EOF along with the bytes.
|
||||
return n, io.EOF
|
||||
|
||||
Reference in new issue
Block a user