-
-
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 directory replaced deps (#738
) When using a directory 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 directory replaced dependency.
- Loading branch information
Showing
1 changed file
with
64 additions
and
0 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
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,64 @@ | ||
# Test that we get diagnostics for errors in directory-replaced module requirements | ||
# | ||
# The scenario involves having a directory 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). | ||
|
||
[golang.org/issues/36745] skip | ||
|
||
# Open dependency via GoToDef | ||
vim ex 'e main.go' | ||
vim ex 'call cursor(6,11)' | ||
vim ex 'GOVIMGoToDef' | ||
vim expr 'expand(''%:p'')' | ||
stdout '^\Q"'$WORK'/p/blah.go"\E$' | ||
|
||
# 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 | ||
} | ||
] |