From b2519014df92becbb54084899e88692059eb33fb Mon Sep 17 00:00:00 2001 From: Josh Baum Date: Mon, 3 Aug 2020 15:35:09 -0400 Subject: [PATCH] internal/lsp: fail test if command cannot be applied In the previous implementation, a test would pass if the given command could not be applied to the given range. Change-Id: I2e63972472cbd146cb5f27a3e27c878387222cb6 Reviewed-on: https://go-review.googlesource.com/c/tools/+/246517 Reviewed-by: Rebecca Stambler --- internal/lsp/lsp_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/lsp/lsp_test.go b/internal/lsp/lsp_test.go index 48d1431a32..6c16c520e5 100644 --- a/internal/lsp/lsp_test.go +++ b/internal/lsp/lsp_test.go @@ -486,7 +486,7 @@ func commandToEdits(ctx context.Context, snapshot source.Snapshot, fh source.Ver return nil, fmt.Errorf("no known command for %s", cmd) } if !command.Applies(ctx, snapshot, fh, rng) { - return nil, nil + return nil, fmt.Errorf("cannot apply %v", command.Name) } return command.SuggestedFix(ctx, snapshot, fh, rng) }