Skip to content

Commit 1b4d99c

Browse files
committed
feat: removed legacy command.Test function #67920
Signed-off-by: nikzayn <[email protected]>
1 parent df4e862 commit 1b4d99c

File tree

3 files changed

+15
-37
lines changed

3 files changed

+15
-37
lines changed

Diff for: gopls/internal/golang/code_lens.go

+15-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ func runTestCodeLens(ctx context.Context, snapshot *cache.Snapshot, fh file.Hand
4848
}
4949
puri := fh.URI()
5050
for _, fn := range testFuncs {
51-
cmd, err := command.NewTestCommand("run test", puri, []string{fn.name}, nil)
51+
cmd, err := command.NewRunTestsCommand("run test", command.RunTestsArgs{
52+
URI: puri,
53+
Tests: []string{fn.name},
54+
Benchmarks: nil,
55+
})
5256
if err != nil {
5357
return nil, err
5458
}
@@ -57,7 +61,11 @@ func runTestCodeLens(ctx context.Context, snapshot *cache.Snapshot, fh file.Hand
5761
}
5862

5963
for _, fn := range benchFuncs {
60-
cmd, err := command.NewTestCommand("run benchmark", puri, nil, []string{fn.name})
64+
cmd, err := command.NewRunTestsCommand("run benchmark", command.RunTestsArgs{
65+
URI: puri,
66+
Tests: nil,
67+
Benchmarks: []string{fn.name},
68+
})
6169
if err != nil {
6270
return nil, err
6371
}
@@ -79,7 +87,11 @@ func runTestCodeLens(ctx context.Context, snapshot *cache.Snapshot, fh file.Hand
7987
for _, fn := range benchFuncs {
8088
benches = append(benches, fn.name)
8189
}
82-
cmd, err := command.NewTestCommand("run file benchmarks", puri, nil, benches)
90+
cmd, err := command.NewRunTestsCommand("run file benchmarks", command.RunTestsArgs{
91+
URI: puri,
92+
Tests: nil,
93+
Benchmarks: benches,
94+
})
8395
if err != nil {
8496
return nil, err
8597
}

Diff for: gopls/internal/protocol/command/command_gen.go

-22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: gopls/internal/protocol/command/interface.go

-12
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,6 @@ type Interface interface {
4545
// Applies a fix to a region of source code.
4646
ApplyFix(context.Context, ApplyFixArgs) (*protocol.WorkspaceEdit, error)
4747

48-
// Test: Run test(s) (legacy)
49-
//
50-
// Runs `go test` for a specific set of test or benchmark functions.
51-
//
52-
// This command is asynchronous; wait for the 'end' progress notification.
53-
//
54-
// This command is an alias for RunTests; the only difference
55-
// is the form of the parameters.
56-
//
57-
// TODO(adonovan): eliminate it.
58-
Test(context.Context, protocol.DocumentURI, []string, []string) error
59-
6048
// Test: Run test(s)
6149
//
6250
// Runs `go test` for a specific set of test or benchmark functions.

0 commit comments

Comments
 (0)