mirror of
https://github.com/securego/gosec.git
synced 2024-12-25 03:55:54 +00:00
Add tests for an empty package without any test file
Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
This commit is contained in:
parent
76b2c12044
commit
bac6f0fb8f
1 changed files with 8 additions and 1 deletions
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue