diff options
author | Brad Fitzpatrick <bradfitz@golang.org> | 2014-07-21 12:06:30 -0700 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@golang.org> | 2014-07-21 12:06:30 -0700 |
commit | 4676e260e3b0f285037bf357e1b91ffb6135273c (patch) | |
tree | c1f5110708500645a8b39e9d4eccc6d27e1b4dc8 /src/cmd/api/goapi_test.go | |
parent | 2ac289c4a095e3133b375ae65c115ff23327a1c4 (diff) | |
download | go-git-4676e260e3b0f285037bf357e1b91ffb6135273c.tar.gz |
cmd/api: ignore internal packages
We might want to add a go/build.IsInternal(pkg string) bool
later, but this works for now.
LGTM=dave, rsc
R=rsc, dave
CC=golang-codereviews
https://golang.org/cl/113300044
Diffstat (limited to 'src/cmd/api/goapi_test.go')
-rw-r--r-- | src/cmd/api/goapi_test.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/cmd/api/goapi_test.go b/src/cmd/api/goapi_test.go index b909c32b34..cb68769c8f 100644 --- a/src/cmd/api/goapi_test.go +++ b/src/cmd/api/goapi_test.go @@ -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 { |