From 63b44b6681b845cf64467ee4a91f79b2ab310cee Mon Sep 17 00:00:00 2001 From: Cosmin Cojocar Date: Tue, 25 Jun 2019 11:56:26 +0200 Subject: [PATCH] Add some more tests to make codecov happy Signed-off-by: Cosmin Cojocar --- analyzer.go | 5 +++++ analyzer_test.go | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/analyzer.go b/analyzer.go index 5828761..8043255 100644 --- a/analyzer.go +++ b/analyzer.go @@ -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) { diff --git a/analyzer_test.go b/analyzer_test.go index 945c108..534bf01 100644 --- a/analyzer_test.go +++ b/analyzer_test.go @@ -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() {