Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/govim: test diagnostics in directory replaced dependencies #738

Merged
merged 1 commit into from
Jan 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions cmd/govim/testdata/scenario_default/quickfix_replaced_dep.txt
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
}
]