Fix test case (invalid sample code)

This commit is contained in:
Grant Murphy 2017-01-11 09:51:25 -08:00
parent d1e67fc995
commit 1e736c8838

View file

@ -120,11 +120,27 @@ func TestHardcodedConstInteger(t *testing.T) {
package main
const (
ATNStateSomethingElse = 1,
ATNStateTokenStart = 42,
ATNStateSomethingElse = 1
ATNStateTokenStart = 42
)
func main() {
println(ATNStateTokenStart)
}`, analyzer)
checkTestResults(t, issues, 0, "Potential hardcoded credentials")
}
func TestHardcodedConstString(t *testing.T) {
config := map[string]interface{}{"ignoreNosec": false}
analyzer := gas.NewAnalyzer(config, nil)
analyzer.AddRule(NewHardcodedCredentials(config))
issues := gasTestRunner(`
package main
const (
ATNStateTokenStart = "foo bar"
)
func main() {
println(ATNStateTokenStart)
}`, analyzer)
checkTestResults(t, issues, 1, "Potential hardcoded credentials")
}