diff options
author | Tianon Gravi <admwiggin@gmail.com> | 2015-01-15 11:54:00 -0700 |
---|---|---|
committer | Tianon Gravi <admwiggin@gmail.com> | 2015-01-15 11:54:00 -0700 |
commit | f154da9e12608589e8d5f0508f908a0c3e88a1bb (patch) | |
tree | f8255d51e10c6f1e0ed69702200b966c9556a431 /src/cmd/api/goapi_test.go | |
parent | 8d8329ed5dfb9622c82a9fbec6fd99a580f9c9f6 (diff) | |
download | golang-upstream/1.4.tar.gz |
Imported Upstream version 1.4upstream/1.4
Diffstat (limited to 'src/cmd/api/goapi_test.go')
-rw-r--r-- | src/cmd/api/goapi_test.go | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/cmd/api/goapi_test.go b/src/cmd/api/goapi_test.go index b909c32b3..f4fb7d319 100644 --- a/src/cmd/api/goapi_test.go +++ b/src/cmd/api/goapi_test.go @@ -38,7 +38,7 @@ func TestGolden(t *testing.T) { continue } - goldenFile := filepath.Join("testdata", "src", "pkg", fi.Name(), "golden.txt") + goldenFile := filepath.Join("testdata", "src", fi.Name(), "golden.txt") w := NewWalker(nil, "testdata/src/pkg") w.export(w.Import(fi.Name())) @@ -142,6 +142,26 @@ func TestCompareAPI(t *testing.T) { } } +func TestSkipInternal(t *testing.T) { + tests := []struct { + pkg string + want bool + }{ + {"net/http", true}, + {"net/http/internal-foo", true}, + {"net/http/internal", false}, + {"net/http/internal/bar", false}, + {"internal/foo", false}, + {"internal", false}, + } + for _, tt := range tests { + got := !internalPkg.MatchString(tt.pkg) + if got != tt.want { + t.Errorf("%s is internal = %v; want %v", tt.pkg, got, tt.want) + } + } +} + func BenchmarkAll(b *testing.B) { stds, err := exec.Command("go", "list", "std").Output() if err != nil { @@ -156,7 +176,7 @@ func BenchmarkAll(b *testing.B) { for i := 0; i < b.N; i++ { for _, context := range contexts { - w := NewWalker(context, filepath.Join(build.Default.GOROOT, "src/pkg")) + w := NewWalker(context, filepath.Join(build.Default.GOROOT, "src")) for _, name := range pkgNames { if name != "unsafe" && !strings.HasPrefix(name, "cmd/") { w.export(w.Import(name)) |