1
0
mirror of https://github.com/golang/go synced 2024-11-05 18:36:10 -07:00
go/internal/lsp/regtest/unix_test.go
Rob Findley 1ff154e68b internal/lsp: lift env out of the sandbox into the editor
This removes some unncessary mangling of strings, and allows the editor
to fully own its configuration.

Change-Id: I0fde206824964124182c9138ee06fb670461d486
Reviewed-on: https://go-review.googlesource.com/c/tools/+/244360
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
2020-07-23 21:58:45 +00:00

37 lines
854 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 files = `
-- main.go --
package main
func _() {
fmt.Println("Hello World")
}
`
editorConfig := fake.EditorConfig{
Env: map[string]string{"GOPATH": ":/path/to/gopath"},
}
// Test the case given in
// https://github.com/fatih/vim-go/issues/2673#issuecomment-622307211.
withOptions(WithEditorConfig(editorConfig)).run(t, files, 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)
}
})
}