Skip to content

Commit

Permalink
Add some more tests to make codecov happy
Browse files Browse the repository at this point in the history
Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
  • Loading branch information
ccojocar committed Jun 25, 2019
1 parent 1412357 commit 63b44b6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions analyzer.go
Expand Up @@ -97,6 +97,11 @@ func (gosec *Analyzer) SetConfig(conf Config) {
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
// packages
func (gosec *Analyzer) LoadRules(ruleDefinitions map[string]RuleBuilder) {
Expand Down
16 changes: 16 additions & 0 deletions analyzer_test.go
Expand Up @@ -416,6 +416,22 @@ var _ = Describe("Analyzer", func() {
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() {
Expand Down

0 comments on commit 63b44b6

Please sign in to comment.