Remove tests case from import tracker

Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
This commit is contained in:
Cosmin Cojocar 2019-04-29 18:41:13 +02:00 committed by Cosmin Cojocar
parent 25b5a1a1ce
commit 48e39323f3

View file

@ -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"}))
})
}) })
}) })