summaryrefslogtreecommitdiffstats
path: root/llgo/third_party/gotools/go/buildutil/allpackages_test.go
blob: 0aa06559656515b7eb185d5bae07317d8b774cdd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package buildutil_test

import (
	"go/build"
	"testing"

	"llvm.org/llgo/third_party/gotools/go/buildutil"
)

func TestAllPackages(t *testing.T) {
	all := buildutil.AllPackages(&build.Default)

	set := make(map[string]bool)
	for _, pkg := range all {
		set[pkg] = true
	}

	const wantAtLeast = 250
	if len(all) < wantAtLeast {
		t.Errorf("Found only %d packages, want at least %d", len(all), wantAtLeast)
	}

	for _, want := range []string{"fmt", "crypto/sha256", "llvm.org/llgo/third_party/gotools/go/buildutil"} {
		if !set[want] {
			t.Errorf("Package %q not found; got %s", want, all)
		}
	}
}
OpenPOWER on IntegriCloud