summaryrefslogtreecommitdiff
path: root/internal/lsp/init_shutdown_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/lsp/init_shutdown_test.go')
-rw-r--r--internal/lsp/init_shutdown_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/internal/lsp/init_shutdown_test.go b/internal/lsp/init_shutdown_test.go
new file mode 100644
index 0000000..7b08f2c
--- /dev/null
+++ b/internal/lsp/init_shutdown_test.go
@@ -0,0 +1,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) }
+}
+