Add tests for an empty package without any test file

Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
This commit is contained in:
Cosmin Cojocar 2019-04-30 11:09:57 +02:00 committed by Cosmin Cojocar
parent 76b2c12044
commit bac6f0fb8f

View file

@ -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() {