diff --git a/packages_test.go b/packages_test.go index 9163aa0a0..d74ba4d3a 100644 --- a/packages_test.go +++ b/packages_test.go @@ -4,6 +4,7 @@ import ( "go/ast" "go/token" "path/filepath" + "runtime" "testing" "github.com/stretchr/testify/assert" @@ -151,6 +152,20 @@ func TestPackage_rangeFiles(t *testing.T) { Path: "testdata/simple/api/api.go", PackagePath: "api", }, + { + Name: &ast.Ident{Name: "foo.go"}, + }: { + File: &ast.File{Name: &ast.Ident{Name: "foo.go"}}, + Path: "vendor/foo/foo.go", + PackagePath: "vendor/foo", + }, + { + Name: &ast.Ident{Name: "bar.go"}, + }: { + File: &ast.File{Name: &ast.Ident{Name: "bar.go"}}, + Path: filepath.Join(runtime.GOROOT(), "bar.go"), + PackagePath: "bar", + }, } var sorted []string