From fc8742f947880e57bf62ebb26b19079dc107afa1 Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Tue, 15 Sep 2020 17:22:55 -0400 Subject: [PATCH] cmd/bundle: expand test coverage to all modes As of CL 189818, bundle has been updated to use the go/packages API to load packages. That API supports module mode and legacy GOPATH mode. Update the test to provide coverage for all modes. Updates golang/go#24661. Change-Id: Ied6196f7317b9b0289faf80dbfe9815e9b98b55d Reviewed-on: https://go-review.googlesource.com/c/tools/+/255053 Trust: Dmitri Shuralyov Run-TryBot: Dmitri Shuralyov gopls-CI: kokoro TryBot-Result: Go Bot Reviewed-by: Bryan C. Mills Reviewed-by: Filippo Valsorda --- cmd/bundle/main_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/bundle/main_test.go b/cmd/bundle/main_test.go index f47acacd013..10d790fa28e 100644 --- a/cmd/bundle/main_test.go +++ b/cmd/bundle/main_test.go @@ -15,7 +15,8 @@ import ( "golang.org/x/tools/go/packages/packagestest" ) -func TestBundle(t *testing.T) { +func TestBundle(t *testing.T) { packagestest.TestAll(t, testBundle) } +func testBundle(t *testing.T, x packagestest.Exporter) { load := func(name string) string { data, err := ioutil.ReadFile(name) if err != nil { @@ -24,7 +25,7 @@ func TestBundle(t *testing.T) { return string(data) } - e := packagestest.Export(t, packagestest.Modules, []packagestest.Module{ + e := packagestest.Export(t, x, []packagestest.Module{ { Name: "initial", Files: map[string]interface{}{