summaryrefslogtreecommitdiff
path: root/src/cmd/api/goapi_test.go
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@golang.org>2014-07-21 12:06:30 -0700
committerBrad Fitzpatrick <bradfitz@golang.org>2014-07-21 12:06:30 -0700
commit4676e260e3b0f285037bf357e1b91ffb6135273c (patch)
treec1f5110708500645a8b39e9d4eccc6d27e1b4dc8 /src/cmd/api/goapi_test.go
parent2ac289c4a095e3133b375ae65c115ff23327a1c4 (diff)
downloadgo-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.go20
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 {