go/packages: fix tests for new go list behaviour
go list has been changed so that when -tests is added it reports the test packages as well as the test mains in the initial set. This fixes all the tests that assumed the old behaviour. I changed the test that checked the initial set to check the entire graph because the comparison became unreadable with the expanded set, and this seemd like a nicer standardised way to check the behaviour. Change-Id: I69404f8ef77cd092b0f02011a7789db71bee9b47 Reviewed-on: https://go-review.googlesource.com/126796 Run-TryBot: Ian Cottrell <iancottrell@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
parent
0700b576e4
commit
cfaff8d5db
|
@ -112,9 +112,9 @@ func TestMetadataImportGraph(t *testing.T) {
|
|||
errors
|
||||
math/bits
|
||||
* subdir/d
|
||||
subdir/d [subdir/d.test]
|
||||
* subdir/d [subdir/d.test]
|
||||
* subdir/d.test
|
||||
subdir/d_test [subdir/d.test]
|
||||
* subdir/d_test [subdir/d.test]
|
||||
unsafe
|
||||
b -> a
|
||||
b -> errors
|
||||
|
@ -204,9 +204,24 @@ func TestMetadataImportGraph(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
const want = "[subdir/d subdir/e subdir/d.test]"
|
||||
if fmt.Sprint(initial) != want {
|
||||
t.Errorf("for subdir/... wildcard, got %s, want %s", initial, want)
|
||||
graph, all = importGraph(initial)
|
||||
wantGraph = `
|
||||
math/bits
|
||||
* subdir/d
|
||||
* subdir/d [subdir/d.test]
|
||||
* subdir/d.test
|
||||
* subdir/d_test [subdir/d.test]
|
||||
* subdir/e
|
||||
subdir/d [subdir/d.test] -> math/bits
|
||||
subdir/d.test -> os (pruned)
|
||||
subdir/d.test -> subdir/d [subdir/d.test]
|
||||
subdir/d.test -> subdir/d_test [subdir/d.test]
|
||||
subdir/d.test -> testing (pruned)
|
||||
subdir/d.test -> testing/internal/testdeps (pruned)
|
||||
subdir/d_test [subdir/d.test] -> subdir/d [subdir/d.test]
|
||||
`[1:]
|
||||
if graph != wantGraph {
|
||||
t.Errorf("wrong import graph: got <<%s>>, want <<%s>>", graph, wantGraph)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue