Rework analyzer unit test to pass the go tip version (#318)

Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
This commit is contained in:
Cosmin Cojocar 2019-05-17 15:35:46 +02:00 committed by GitHub
parent 9d9098fa97
commit 0ebfa2f8b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -277,14 +277,18 @@ var _ = Describe("Analyzer", func() {
pkg.AddFile("foo_test.go", ` pkg.AddFile("foo_test.go", `
package foo_test package foo_test
import "testing" import "testing"
func test() error {
return nil
}
func TestFoo(t *testing.T){ func TestFoo(t *testing.T){
test()
}`) }`)
err := pkg.Build() err := pkg.Build()
Expect(err).ShouldNot(HaveOccurred()) Expect(err).ShouldNot(HaveOccurred())
err = customAnalyzer.Process(buildTags, pkg.Path) err = customAnalyzer.Process(buildTags, pkg.Path)
Expect(err).ShouldNot(HaveOccurred()) Expect(err).ShouldNot(HaveOccurred())
_, metrics, _ := customAnalyzer.Report() issues, _, _ := customAnalyzer.Report()
Expect(metrics.NumFiles).To(Equal(3)) Expect(issues).Should(HaveLen(1))
}) })
}) })