go/analysis: enable a test that applies after go list behavior change

The despite-error case in TestRunDespiteErrors only returns error code 1
after golang.org/cl/437298. This CL enables the test for Go 1.20+.

Change-Id: Ib212026d595e7bf872aa2482e1d91723010e7018
Reviewed-on: https://go-review.googlesource.com/c/tools/+/441880
Run-TryBot: Michael Matloob <matloob@golang.org>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Michael Matloob 2022-10-10 18:10:03 -04:00
parent b50d7ba6ee
commit 9eda97bc2d
1 changed files with 2 additions and 1 deletions

View File

@ -172,7 +172,8 @@ func Foo(s string) int {
// no errors
{name: "no-errors", pattern: []string{"sort"}, analyzers: []*analysis.Analyzer{analyzer, noop}, code: 0},
} {
if test.name == "despite-error" { // TODO(matloob): once CL 437298 is submitted, add the condition testenv.Go1Point() < 20
if test.name == "despite-error" && testenv.Go1Point() < 20 {
// The behavior in the comment on the despite-error test only occurs for Go 1.20+.
continue
}
if got := checker.Run(test.pattern, test.analyzers); got != test.code {