mirror of
https://github.com/securego/gosec.git
synced 2024-11-05 19:45:51 +00:00
Add some more tests to make codecov happy
Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
This commit is contained in:
parent
141235719b
commit
63b44b6681
2 changed files with 21 additions and 0 deletions
|
@ -97,6 +97,11 @@ func (gosec *Analyzer) SetConfig(conf Config) {
|
||||||
gosec.config = conf
|
gosec.config = conf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Config returns the current configuration
|
||||||
|
func (gosec *Analyzer) Config() Config {
|
||||||
|
return gosec.config
|
||||||
|
}
|
||||||
|
|
||||||
// LoadRules instantiates all the rules to be used when analyzing source
|
// LoadRules instantiates all the rules to be used when analyzing source
|
||||||
// packages
|
// packages
|
||||||
func (gosec *Analyzer) LoadRules(ruleDefinitions map[string]RuleBuilder) {
|
func (gosec *Analyzer) LoadRules(ruleDefinitions map[string]RuleBuilder) {
|
||||||
|
|
|
@ -416,6 +416,22 @@ var _ = Describe("Analyzer", func() {
|
||||||
Expect(ferr[1].Err).Should(MatchRegexp(`error2`))
|
Expect(ferr[1].Err).Should(MatchRegexp(`error2`))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
It("should set the config", func() {
|
||||||
|
config := gosec.NewConfig()
|
||||||
|
config["test"] = "test"
|
||||||
|
analyzer.SetConfig(config)
|
||||||
|
found := analyzer.Config()
|
||||||
|
Expect(config).To(Equal(found))
|
||||||
|
})
|
||||||
|
|
||||||
|
It("should reset the analyzer", func() {
|
||||||
|
analyzer.Reset()
|
||||||
|
issues, metrics, errors := analyzer.Report()
|
||||||
|
Expect(issues).To(BeEmpty())
|
||||||
|
Expect(*metrics).To(Equal(gosec.Metrics{}))
|
||||||
|
Expect(errors).To(BeEmpty())
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
Context("when appending errors", func() {
|
Context("when appending errors", func() {
|
||||||
|
|
Loading…
Reference in a new issue