[tools] gopls/internal/cmd: add tests of 'gopls help'

0 views
Skip to first unread message

Alan Donovan (Gerrit)

unread,
Jun 25, 2026, 1:02:37 PM (2 days ago) Jun 25
to goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, golang...@luci-project-accounts.iam.gserviceaccount.com, Hyang-Ah Hana Kim, Hongxiang Jiang, Alex Putman, golang-co...@googlegroups.com

Alan Donovan submitted the change with unreviewed changes

Unreviewed changes

3 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:

```
The name of the file: gopls/internal/cmd/help_test.go
Insertions: 13, Deletions: 14.

@@ -98,32 +98,32 @@
}{
// gopls help
{
- []string{"help"},
- true,
- []string{
+ args: []string{"help"},
+ wantSuccess: true,
+ wantPatterns: []string{
"gopls is a Go language server",
"https://go.dev/gopls/features",
"Usage:",
"Command:",
- " links list links in a file", // command menu
+ " links.*list links in a file", // command menu
},
},
// gopls help remote
{
- []string{"help", "remote"},
- true,
- []string{
+ args: []string{"help", "remote"},
+ wantSuccess: true,
+ wantPatterns: []string{
"interact with the gopls daemon",
"Usage:",
"Subcommand:",
- " sessions print information about current gopls sessions", // subcommand menu
+ " sessions.*print information about current gopls sessions", // subcommand menu
},
},
// gopls help remote sessions
{
- []string{"help", "remote", "sessions"},
- true,
- []string{
+ args: []string{"help", "remote", "sessions"},
+ wantSuccess: true,
+ wantPatterns: []string{
"print information about current gopls sessions",
"Usage:",
"list sessions for the default daemon",
@@ -131,9 +131,8 @@
},
// gopls help remote nonesuch
{
- []string{"help", "remote", "nonesuch"},
- false,
- []string{
+ args: []string{"help", "remote", "nonesuch"},
+ wantPatterns: []string{
"gopls: no such subcommand: remote nonesuch",
},
},
```

Change information

Commit message:
gopls/internal/cmd: add tests of 'gopls help'

This CL turns tests that call tool.Run (which includes
only a part of the initialization process and is not
a reliable simulation of the gopls executable)
into true CLI integration tests.

These missing tests would have caught regressions in recent work
that was rolled back before the release. (See CL 793600.)

Also, use correct URL in help message.

For golang/go#80133
Change-Id: I985b48e7b44d74e4d481172a2cbe5e9b5804984b
Reviewed-by: Hyang-Ah Hana Kim <hya...@gmail.com>
Reviewed-by: Alex Putman <apu...@golang.org>
Files:
  • M gopls/internal/cmd/cmd.go
  • M gopls/internal/cmd/help_test.go
  • M gopls/internal/cmd/usage/usage-v.hlp
  • M gopls/internal/cmd/usage/usage.hlp
Change size: M
Delta: 4 files changed, 90 insertions(+), 31 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: I985b48e7b44d74e4d481172a2cbe5e9b5804984b
Gerrit-Change-Number: 794300
Gerrit-PatchSet: 5
Gerrit-Owner: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Alex Putman <apu...@golang.org>
Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages