github.com/llvm-mirror/llgo@v0.0.0-20190322182713-bf6f0a60fce1/third_party/gotools/go/buildutil/allpackages_test.go (about) 1 // Copyright 2014 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package buildutil_test 6 7 import ( 8 "go/build" 9 "testing" 10 11 "llvm.org/llgo/third_party/gotools/go/buildutil" 12 ) 13 14 func TestAllPackages(t *testing.T) { 15 all := buildutil.AllPackages(&build.Default) 16 17 set := make(map[string]bool) 18 for _, pkg := range all { 19 set[pkg] = true 20 } 21 22 const wantAtLeast = 250 23 if len(all) < wantAtLeast { 24 t.Errorf("Found only %d packages, want at least %d", len(all), wantAtLeast) 25 } 26 27 for _, want := range []string{"fmt", "crypto/sha256", "llvm.org/llgo/third_party/gotools/go/buildutil"} { 28 if !set[want] { 29 t.Errorf("Package %q not found; got %s", want, all) 30 } 31 } 32 }