From bac6f0fb8f8cd0e45e8cdb2c723f8eff8e8730e2 Mon Sep 17 00:00:00 2001 From: Cosmin Cojocar Date: Tue, 30 Apr 2019 11:09:57 +0200 Subject: [PATCH] Add tests for an empty package without any test file Signed-off-by: Cosmin Cojocar --- analyzer_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/analyzer_test.go b/analyzer_test.go index 1afac2f..7d6ba9b 100644 --- a/analyzer_test.go +++ b/analyzer_test.go @@ -229,7 +229,7 @@ var _ = Describe("Analyzer", func() { Expect(err).Should(HaveOccurred()) }) - It("should process an empty package", func() { + It("should process an empty package with test file", func() { analyzer.LoadRules(rules.Generate().Builders()) pkg := testutils.NewTestPackage() defer pkg.Close() @@ -243,6 +243,13 @@ var _ = Describe("Analyzer", func() { err = analyzer.Process(buildTags, pkg.Path) Expect(err).ShouldNot(HaveOccurred()) }) + It("should report an error when the package is empty", func() { + analyzer.LoadRules(rules.Generate().Builders()) + pkg := testutils.NewTestPackage() + defer pkg.Close() + err := analyzer.Process(buildTags, pkg.Path) + Expect(err).Should(HaveOccurred()) + }) }) It("should be possible to overwrite nosec comments, and report issues", func() {