BenchmarkHandler_DidOpen benchmarks document open notification
(b *testing.B)
| 297 | |
| 298 | // BenchmarkHandler_DidOpen benchmarks document open notification |
| 299 | func BenchmarkHandler_DidOpen(b *testing.B) { |
| 300 | sql := "SELECT * FROM users WHERE id = 1" |
| 301 | |
| 302 | didOpenParams := DidOpenTextDocumentParams{ |
| 303 | TextDocument: TextDocumentItem{ |
| 304 | URI: "file:///test.sql", |
| 305 | LanguageID: "sql", |
| 306 | Version: 1, |
| 307 | Text: sql, |
| 308 | }, |
| 309 | } |
| 310 | paramsJSON, _ := json.Marshal(didOpenParams) |
| 311 | |
| 312 | b.ReportAllocs() |
| 313 | b.ResetTimer() |
| 314 | for i := 0; i < b.N; i++ { |
| 315 | server := setupTestServer() |
| 316 | server.handler.HandleNotification("textDocument/didOpen", paramsJSON) |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | // BenchmarkHandler_DidChange benchmarks document change notification |
| 321 | func BenchmarkHandler_DidChange(b *testing.B) { |
nothing calls this directly
no test coverage detected