Add a test to cover the processing of empty packages

Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
This commit is contained in:
Cosmin Cojocar 2019-04-30 10:21:16 +02:00 committed by Cosmin Cojocar
parent b04c1ce0a7
commit 76b2c12044

View file

@ -228,6 +228,21 @@ var _ = Describe("Analyzer", func() {
err := analyzer.Process(buildTags, pkg.Path)
Expect(err).Should(HaveOccurred())
})
It("should process an empty package", func() {
analyzer.LoadRules(rules.Generate().Builders())
pkg := testutils.NewTestPackage()
defer pkg.Close()
pkg.AddFile("foo_test.go", `
package tests
import "testing"
func TestFoo(t *testing.T){
}`)
err := pkg.Build()
Expect(err).ShouldNot(HaveOccurred())
err = analyzer.Process(buildTags, pkg.Path)
Expect(err).ShouldNot(HaveOccurred())
})
})
It("should be possible to overwrite nosec comments, and report issues", func() {