mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-12-01 13:34:23 +01:00
Merge pull request #1 from eargollo/windows-test
Adapt test message to run tests in Windows
This commit is contained in:
1 file changed
+11
-2
+11
-2
@@ -6,6 +6,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
@@ -182,7 +183,7 @@ func TestRun(t *testing.T) {
|
|||||||
},
|
},
|
||||||
description: "test leak",
|
description: "test leak",
|
||||||
numLeaks: 0,
|
numLeaks: 0,
|
||||||
expectedErrMsg: "unable to generate ssh key: open trash: no such file or directory",
|
expectedErrMsg: fmt.Sprintf("unable to generate ssh key: open trash: %s", noSuchFileMessage()),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
testOpts: &Options{
|
testOpts: &Options{
|
||||||
@@ -749,7 +750,7 @@ func TestLoadToml(t *testing.T) {
|
|||||||
testOpts: &Options{},
|
testOpts: &Options{},
|
||||||
description: "env var path to no config",
|
description: "env var path to no config",
|
||||||
configPath: noConfigPath,
|
configPath: noConfigPath,
|
||||||
expectedErrMsg: fmt.Sprintf("problem loading config: open %s: no such file or directory", noConfigPath),
|
expectedErrMsg: fmt.Sprintf("problem loading config: open %s: %s", noConfigPath, noSuchFileMessage()),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -773,3 +774,11 @@ func TestLoadToml(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func noSuchFileMessage() string {
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
// Adapt to Windws
|
||||||
|
return "The system cannot find the file specified."
|
||||||
|
}
|
||||||
|
return "no such file or directory"
|
||||||
|
}
|
||||||
Reference in new issue
Block a user