Skip to content

Commit 63b44b6

Browse files
committed
Add some more tests to make codecov happy
Signed-off-by: Cosmin Cojocar <[email protected]>
1 parent 1412357 commit 63b44b6

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

analyzer.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ func (gosec *Analyzer) SetConfig(conf Config) {
9797
gosec.config = conf
9898
}
9999

100+
// Config returns the current configuration
101+
func (gosec *Analyzer) Config() Config {
102+
return gosec.config
103+
}
104+
100105
// LoadRules instantiates all the rules to be used when analyzing source
101106
// packages
102107
func (gosec *Analyzer) LoadRules(ruleDefinitions map[string]RuleBuilder) {

analyzer_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,22 @@ var _ = Describe("Analyzer", func() {
416416
Expect(ferr[1].Err).Should(MatchRegexp(`error2`))
417417
}
418418
})
419+
420+
It("should set the config", func() {
421+
config := gosec.NewConfig()
422+
config["test"] = "test"
423+
analyzer.SetConfig(config)
424+
found := analyzer.Config()
425+
Expect(config).To(Equal(found))
426+
})
427+
428+
It("should reset the analyzer", func() {
429+
analyzer.Reset()
430+
issues, metrics, errors := analyzer.Report()
431+
Expect(issues).To(BeEmpty())
432+
Expect(*metrics).To(Equal(gosec.Metrics{}))
433+
Expect(errors).To(BeEmpty())
434+
})
419435
})
420436

421437
Context("when appending errors", func() {

0 commit comments

Comments
 (0)