Skip to content

Commit

Permalink
Add a test to cover the processing of empty packages
Browse files Browse the repository at this point in the history
Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
  • Loading branch information
ccojocar authored and Cosmin Cojocar committed May 1, 2019
1 parent b04c1ce commit 76b2c12
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions analyzer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 76b2c12

Please sign in to comment.