mirror of
https://github.com/securego/gosec.git
synced 2024-12-28 21:08:22 +02:00
Remove tests case from import tracker
Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
This commit is contained in:
parent
25b5a1a1ce
commit
48e39323f3
@ -50,28 +50,5 @@ var _ = Describe("Import Tracker", func() {
|
|||||||
tracker.TrackFile(files[0])
|
tracker.TrackFile(files[0])
|
||||||
Expect(tracker.Imported).Should(Equal(map[string]string{"fmt": "fmt"}))
|
Expect(tracker.Imported).Should(Equal(map[string]string{"fmt": "fmt"}))
|
||||||
})
|
})
|
||||||
It("should not parse the init imports from file", func() {
|
|
||||||
tracker := gosec.NewImportTracker()
|
|
||||||
pkg := testutils.NewTestPackage()
|
|
||||||
defer pkg.Close()
|
|
||||||
pkg.AddFile("foo.go", `
|
|
||||||
package foo
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
_ "os"
|
|
||||||
)
|
|
||||||
func foo() {
|
|
||||||
fmt.Println()
|
|
||||||
}
|
|
||||||
`)
|
|
||||||
err := pkg.Build()
|
|
||||||
Expect(err).ShouldNot(HaveOccurred())
|
|
||||||
pkgs := pkg.Pkgs()
|
|
||||||
Expect(pkgs).Should(HaveLen(1))
|
|
||||||
files := pkgs[0].Syntax
|
|
||||||
Expect(files).Should(HaveLen(1))
|
|
||||||
tracker.TrackFile(files[1])
|
|
||||||
Expect(tracker.Imported).Should(Equal(map[string]string{"fmt": "fmt"}))
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user