mirror of
https://github.com/golang/go
synced 2024-11-19 02:34:44 -07:00
0310561d58
It was directly generating messages and sending them on the conn, now it just uses an editor method like all the other tests. It was also broken because it never opened the file it was hovering in, so I am not sure it was testing anything useful before. Change-Id: I7a1b444015c95c82a0a137d3bb1da661ed9331af Reviewed-on: https://go-review.googlesource.com/c/tools/+/232983 Run-TryBot: Ian Cottrell <iancottrell@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
37 lines
729 B
Go
37 lines
729 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.
|
|
|
|
package regtest
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"golang.org/x/tools/internal/lsp/fake"
|
|
)
|
|
|
|
const simpleProgram = `
|
|
-- go.mod --
|
|
module mod.com
|
|
|
|
go 1.12
|
|
-- main.go --
|
|
package main
|
|
|
|
import "fmt"
|
|
|
|
func main() {
|
|
fmt.Println("Hello World.")
|
|
}`
|
|
|
|
func TestHoverSerialization(t *testing.T) {
|
|
runner.Run(t, simpleProgram, func(t *testing.T, env *Env) {
|
|
// Hover on an empty line.
|
|
env.OpenFile("main.go")
|
|
content, pos := env.Hover("main.go", fake.Pos{Line: 3, Column: 0})
|
|
if content != nil {
|
|
t.Errorf("got non-empty response for empty hover: %v: %v", pos, *content)
|
|
}
|
|
})
|
|
}
|