...
1
2
3
4
5 package packagestest_test
6
7 import (
8 "path/filepath"
9 "testing"
10
11 "golang.org/x/tools/go/packages/packagestest"
12 )
13
14 func TestGOPATHExport(t *testing.T) {
15 exported := packagestest.Export(t, packagestest.GOPATH, testdata)
16 defer exported.Cleanup()
17
18 var expectDir = filepath.Join(exported.Temp(), "fake1", "src")
19 if exported.Config.Dir != expectDir {
20 t.Errorf("Got working directory %v expected %v", exported.Config.Dir, expectDir)
21 }
22 checkFiles(t, exported, []fileTest{
23 {"golang.org/fake1", "a.go", "fake1/src/golang.org/fake1/a.go", checkLink("testdata/a.go")},
24 {"golang.org/fake1", "b.go", "fake1/src/golang.org/fake1/b.go", checkContent("package fake1")},
25 {"golang.org/fake2", "other/a.go", "fake2/src/golang.org/fake2/other/a.go", checkContent("package fake2")},
26 {"golang.org/fake2/v2", "other/a.go", "fake2_v2/src/golang.org/fake2/v2/other/a.go", checkContent("package fake2")},
27 })
28 }
29
View as plain text