summaryrefslogtreecommitdiff
path: root/internal/lsp/init_shutdown_test.go
blob: 7b08f2c98051df902d6071db1c3bdf8c99a83b11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package lsp

import (
    "bytes"
    "encoding/json"
    "io"
    "log"
    "testing"
)

func TestHandleShutdown_Replies(t *testing.T) {
    var out bytes.Buffer
    s := &Server{logger: log.New(io.Discard, "", 0), docs: make(map[string]*document), out: &out}
    req := Request{JSONRPC: "2.0", ID: json.RawMessage("12"), Method: "shutdown"}
    out.Reset()
    s.handleShutdown(req)
    resp := captureResponse(t, &out)
    if string(resp.ID) != "12" || resp.Error != nil { t.Fatalf("unexpected shutdown response: %+v", resp) }
}