-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/govim: test introducing diagnostics in locally replaced dependencies
When using a locally replaced dependency it isn't monitored by gopls, see https://golang.org/issues/36745. This change adds a test that verifies that we do get diagnostics from gopls when introducing errors in a replaced dependency.
- Loading branch information
Showing
1 changed file
with
63 additions
and
0 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
cmd/govim/testdata/scenario_default/quickfix_replaced_dep.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Test that we get diagnostics for edits in a locally replaced dependency | ||
# | ||
# The scenario involves having a locally replaced dependency in go.mod. | ||
# When there is an error introduced into the local copy it should produce | ||
# a diagnostic (see https://golang.org/issues/36745). | ||
|
||
skip 'Pending fix for golang.org/issues/36745' | ||
|
||
# Open dependency via GoToDef | ||
vim ex 'e main.go' | ||
vim ex 'call cursor(6,11)' | ||
vim ex 'GOVIMGoToDef' | ||
errlogmatch '&protocol\.DidOpenTextDocumentParams\{\n\S+:\s+TextDocument: protocol.TextDocumentItem{URI:"file://'$WORK/p/blah.go | ||
|
||
# Add some nonsense to introduce a compile error | ||
vim call append '[3, "asd"]' | ||
|
||
# Expect the error to be reported | ||
vimexprwait error.golden GOVIMTest_getqflist() | ||
|
||
# Assert that we have received no error (Type: 1) or warning (Type: 2) log messages | ||
# Disabled pending resolution to https://github.com/golang/go/issues/34103 | ||
# errlogmatch -start -count=0 'LogMessage callback: &protocol\.LogMessageParams\{Type:(1|2), Message:".*' | ||
|
||
-- go.mod -- | ||
module a | ||
|
||
go 1.12 | ||
|
||
replace example.com/blah => ./p | ||
|
||
require example.com/blah v1.0.0 | ||
-- main.go -- | ||
package main | ||
|
||
import "example.com/blah" | ||
|
||
func main() { | ||
_ = blah.Name | ||
} | ||
-- p/go.mod -- | ||
module example.com/blah | ||
|
||
go 1.12 | ||
-- p/blah.go -- | ||
package blah | ||
|
||
const Name = "example.com/blah" | ||
-- error.golden -- | ||
[ | ||
{ | ||
"bufname": "p/blah.go", | ||
"col": 1, | ||
"lnum": 4, | ||
"module": "", | ||
"nr": 0, | ||
"pattern": "", | ||
"text": "expected declaration, found asd", | ||
"type": "", | ||
"valid": 1, | ||
"vcol": 0 | ||
} | ||
] |