mirror of
https://github.com/securego/gosec.git
synced 2024-12-25 20:15:54 +00:00
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:
parent
9d9098fa97
commit
0ebfa2f8b7
1 changed files with 6 additions and 2 deletions
|
@ -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))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue