mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 20:54:22 +01:00
[progress] stricter regex, tests
This commit is contained in:
1 parent
595da56eef
commit
ec654441bb
3 files changed
+44
-21
No files matched your search
@@ -0,0 +1,21 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCheckRegex(t *testing.T) {
|
||||
var secretsPresent bool
|
||||
checks := map[string]bool{
|
||||
"github.com": false,
|
||||
"github.com/user/": false,
|
||||
"github_api_client = \"sample key\"": true,
|
||||
}
|
||||
|
||||
for k, v := range checks {
|
||||
_, secretsPresent = checkRegex(k)
|
||||
if v != secretsPresent {
|
||||
t.Errorf("regexCheck failed on string %s. Expected secretsPresent: %t, got %t", k, v, secretsPresent)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user