mirror of
https://github.com/securego/gosec.git
synced 2024-11-05 19:45:51 +00:00
Add a test to cover the processing of empty packages
Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
This commit is contained in:
parent
b04c1ce0a7
commit
76b2c12044
1 changed files with 15 additions and 0 deletions
|
@ -228,6 +228,21 @@ var _ = Describe("Analyzer", func() {
|
||||||
err := analyzer.Process(buildTags, pkg.Path)
|
err := analyzer.Process(buildTags, pkg.Path)
|
||||||
Expect(err).Should(HaveOccurred())
|
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() {
|
It("should be possible to overwrite nosec comments, and report issues", func() {
|
||||||
|
|
Loading…
Reference in a new issue