1
0
mirror of https://github.com/golang/go synced 2024-11-05 17:26:11 -07:00
go/internal/lsp/regtest/unix_test.go
Rebecca Stambler 91d71f6c2f internal/lsp/regtest: add a t.Skip for golang/go#36824 regtest
Switching to using a t.Skip means we are more likely to remember to
actually re-enable the test at some point.

Also picked up a staticcheck fix along the way.

Change-Id: I382eaa8d204bee74a7ff46e8a1b11dab567b83ae
Reviewed-on: https://go-review.googlesource.com/c/tools/+/234757
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Peter Weinberger <pjw@google.com>
2020-05-21 15:57:04 +00:00

36 lines
823 B
Go

// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !windows,!plan9
package regtest
import (
"testing"
"golang.org/x/tools/internal/lsp/fake"
)
func TestBadGOPATH(t *testing.T) {
const missingImport = `
-- main.go --
package main
func _() {
fmt.Println("Hello World")
}
`
// Test the case given in
// https://github.com/fatih/vim-go/issues/2673#issuecomment-622307211.
runner.Run(t, missingImport, func(t *testing.T, env *Env) {
env.OpenFile("main.go")
env.Await(env.DiagnosticAtRegexp("main.go", "fmt"))
if err := env.Editor.OrganizeImports(env.Ctx, "main.go"); err != nil {
t.Fatal(err)
}
}, WithEditorConfig(fake.EditorConfig{
Env: []string{"GOPATH=:/path/to/gopath"},
}))
}