MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestFunctional_Hover_KnownKeyword

Function TestFunctional_Hover_KnownKeyword

pkg/lsp/handler_functional_test.go:183–207  ·  view source on GitHub ↗

--------------------------------------------------------------------------- Hover ---------------------------------------------------------------------------

(t *testing.T)

Source from the content-addressed store, hash-verified

181// ---------------------------------------------------------------------------
182
183func TestFunctional_Hover_KnownKeyword(t *testing.T) {
184 mock := newMockReadWriter()
185 logger := log.New(io.Discard, "", 0)
186 server := NewServer(mock.input, mock.output, logger)
187
188 server.Documents().Open("file:///test.sql", "sql", 1, "SELECT * FROM users")
189
190 params := TextDocumentPositionParams{
191 TextDocument: TextDocumentIdentifier{URI: "file:///test.sql"},
192 Position: Position{Line: 0, Character: 2}, // inside "SELECT"
193 }
194 raw, _ := json.Marshal(params)
195 result, err := server.handler.HandleRequest("textDocument/hover", raw)
196 if err != nil {
197 t.Fatal(err)
198 }
199
200 hover := result.(*Hover)
201 if hover.Contents.Value == "" {
202 t.Error("expected hover documentation for SELECT")
203 }
204 if !strings.Contains(hover.Contents.Value, "SELECT") {
205 t.Error("hover docs should mention SELECT")
206 }
207}
208
209func TestFunctional_Hover_UnknownWord(t *testing.T) {
210 mock := newMockReadWriter()

Callers

nothing calls this directly

Calls 6

DocumentsMethod · 0.95
newMockReadWriterFunction · 0.85
NewServerFunction · 0.85
OpenMethod · 0.80
HandleRequestMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected