| // Copyright 2020 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. |
| func TestBuildList(t *testing.T) { |
| // This test is in the golang.org/x/module. |
| // Check that buildList(".") returns sensible results. |
| main, deps := buildList(".") |
| Path: "golang.org/x/build", |
| t.Errorf("got main = %+v, want %+v", main, want) |
| t.Errorf("deps[%d]: module path is empty", i) |
| t.Errorf("deps[%d]: unexpectedly a main module", i) |
| t.Errorf("buildList returned %d (less than 10) non-main modules in build list of x/build; "+ |
| "either buildList is broken or TestBuildList needs to be updated (that'll be the day)", |
| func TestGOROOTVersion(t *testing.T) { |
| // This test requires Go 1.14 or higher to run. |
| // Verify gorootVersion(runtime.GOROOT()) returns a fitting version. |
| v, err := gorootVersion(runtime.GOROOT()) |
| t.Fatal("gorootVersion returned non-nil error:", err) |
| t.Errorf("gorootVersion returned unexpectedly low version %d", v) |