diff options
| author | Paul Buetow <paul@buetow.org> | 2025-09-06 10:56:27 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-09-06 10:56:27 +0300 |
| commit | 320de746f7a2985b60c8564a0e65bdf231e840b7 (patch) | |
| tree | e70bcf50813dba411afa2934e774383124bbc99e /internal/lsp/document_test.go | |
| parent | 06247527d5170f329b454b42f59a3e4434ab1f4b (diff) | |
use gofumpt
Diffstat (limited to 'internal/lsp/document_test.go')
| -rw-r--r-- | internal/lsp/document_test.go | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/internal/lsp/document_test.go b/internal/lsp/document_test.go index 5fee18b..00e4548 100644 --- a/internal/lsp/document_test.go +++ b/internal/lsp/document_test.go @@ -9,20 +9,20 @@ import ( ) func newTestServer() *Server { - s := &Server{ - logger: log.New(io.Discard, "", 0), - docs: make(map[string]*document), - inlineOpen: ">", - inlineClose: ">", - chatSuffix: ">", - chatPrefixes: []string{"?","!",":",";"}, - } - // Keep package-level helpers in sync for tests using free functions - inlineOpenChar = '>' - inlineCloseChar = '>' - chatSuffixChar = '>' - chatPrefixSingles = []string{"?","!",":",";"} - return s + s := &Server{ + logger: log.New(io.Discard, "", 0), + docs: make(map[string]*document), + inlineOpen: ">", + inlineClose: ">", + chatSuffix: ">", + chatPrefixes: []string{"?", "!", ":", ";"}, + } + // Keep package-level helpers in sync for tests using free functions + inlineOpenChar = '>' + inlineCloseChar = '>' + chatSuffixChar = '>' + chatPrefixSingles = []string{"?", "!", ":", ";"} + return s } func TestSplitLines(t *testing.T) { @@ -71,12 +71,14 @@ func TestLineContext_EmptyDoc(t *testing.T) { } func TestDocBeforeAfter_ClampsIndices(t *testing.T) { - s := newTestServer() - uri := "file:///clamp.go" - s.setDocument(uri, "abc\nxyz") - // Position beyond document length should be clamped safely - before, after := s.docBeforeAfter(uri, Position{Line: 99, Character: 99}) - if before == "" && after == "" { t.Fatalf("expected some text with clamped indices") } + s := newTestServer() + uri := "file:///clamp.go" + s.setDocument(uri, "abc\nxyz") + // Position beyond document length should be clamped safely + before, after := s.docBeforeAfter(uri, Position{Line: 99, Character: 99}) + if before == "" && after == "" { + t.Fatalf("expected some text with clamped indices") + } } func TestTrimLen(t *testing.T) { |
