1
0
mirror of https://github.com/golang/go synced 2024-10-01 05:28:33 -06:00

go/packages: fix broken tests to handle changes to packagestest

golang.org/cl/161317 set Tests to true in the packagestest go/packages
Config. Handle this in the go/packages tests.

Fixes golang/go#30115

Change-Id: I6b4c0ca3dc2d73855239f3e7122e29da6ce81657
Reviewed-on: https://go-review.googlesource.com/c/161457
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
Rebecca Stambler 2019-02-06 17:04:16 -05:00
parent a8576e2603
commit 44bcb96178

View File

@ -99,6 +99,10 @@ func testLoadImportsGraph(t *testing.T, exporter packagestest.Exporter) {
* golang.org/fake/c
* golang.org/fake/e
* golang.org/fake/subdir/d
* golang.org/fake/subdir/d [golang.org/fake/subdir/d.test]
* golang.org/fake/subdir/d.test
* golang.org/fake/subdir/d_test [golang.org/fake/subdir/d.test]
math/bits
unsafe
golang.org/fake/b -> errors
golang.org/fake/b -> golang.org/fake/a
@ -106,6 +110,13 @@ func testLoadImportsGraph(t *testing.T, exporter packagestest.Exporter) {
golang.org/fake/c -> unsafe
golang.org/fake/e -> golang.org/fake/b
golang.org/fake/e -> golang.org/fake/c
golang.org/fake/subdir/d [golang.org/fake/subdir/d.test] -> math/bits
golang.org/fake/subdir/d.test -> golang.org/fake/subdir/d [golang.org/fake/subdir/d.test]
golang.org/fake/subdir/d.test -> golang.org/fake/subdir/d_test [golang.org/fake/subdir/d.test]
golang.org/fake/subdir/d.test -> os (pruned)
golang.org/fake/subdir/d.test -> testing (pruned)
golang.org/fake/subdir/d.test -> testing/internal/testdeps (pruned)
golang.org/fake/subdir/d_test [golang.org/fake/subdir/d.test] -> golang.org/fake/subdir/d [golang.org/fake/subdir/d.test]
`[1:]
if graph != wantGraph {
@ -1268,7 +1279,10 @@ func testRedundantQueries(t *testing.T, exporter packagestest.Exporter) {
}}})
defer exported.Cleanup()
initial, err := packages.Load(exported.Config, "errors", "iamashamedtousethedisabledqueryname=errors")
cfg := *exported.Config
cfg.Tests = false
initial, err := packages.Load(&cfg, "errors", "iamashamedtousethedisabledqueryname=errors")
if err != nil {
t.Fatal(err)
}